TechNet
Export (0) Print
Expand All

ToolTip Class

 

Represents a small rectangular pop-up window that displays a brief description of a control's purpose when the user rests the pointer on the control.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

System.Object
  System.MarshalByRefObject
    System.ComponentModel.Component
      System.Windows.Forms.ToolTip

type ToolTip = 
    class
        inherit Component
        interface IExtenderProvider
    end

NameDescription
System_CAPS_pubmethodToolTip()

Initializes a new instance of the ToolTip without a specified container.

System_CAPS_pubmethodToolTip(IContainer)

Initializes a new instance of the ToolTip class with a specified container.

NameDescription
System_CAPS_pubpropertyActive

Gets or sets a value indicating whether the ToolTip is currently active.

System_CAPS_pubpropertyAutomaticDelay

Gets or sets the automatic delay for the ToolTip.

System_CAPS_pubpropertyAutoPopDelay

Gets or sets the period of time the ToolTip remains visible if the pointer is stationary on a control with specified ToolTip text.

System_CAPS_pubpropertyBackColor

Gets or sets the background color for the ToolTip.

System_CAPS_protpropertyCanRaiseEvents

Gets a value indicating whether the component can raise an event.(Inherited from Component.)

System_CAPS_pubpropertyContainer

Gets the IContainer that contains the Component.(Inherited from Component.)

System_CAPS_protpropertyCreateParams

This API supports the product infrastructure and is not intended to be used directly from your code. Gets the creation parameters for the ToolTip window.

System_CAPS_protpropertyDesignMode

Gets a value that indicates whether the Component is currently in design mode.(Inherited from Component.)

System_CAPS_protpropertyEvents

Gets the list of event handlers that are attached to this Component.(Inherited from Component.)

System_CAPS_pubpropertyForeColor

Gets or sets the foreground color for the ToolTip.

System_CAPS_pubpropertyInitialDelay

Gets or sets the time that passes before the ToolTip appears.

System_CAPS_pubpropertyIsBalloon

Gets or sets a value indicating whether the ToolTip should use a balloon window.

System_CAPS_pubpropertyOwnerDraw

Gets or sets a value indicating whether the ToolTip is drawn by the operating system or by code that you provide.

System_CAPS_pubpropertyReshowDelay

Gets or sets the length of time that must transpire before subsequent ToolTip windows appear as the pointer moves from one control to another.

System_CAPS_pubpropertyShowAlways

Gets or sets a value indicating whether a ToolTip window is displayed, even when its parent control is not active.

System_CAPS_pubpropertySite

Gets or sets the ISite of the Component.(Inherited from Component.)

System_CAPS_pubpropertyStripAmpersands

Gets or sets a value that determines how ampersand (&) characters are treated.

System_CAPS_pubpropertyTag

Gets or sets the object that contains programmer-supplied data associated with the ToolTip.

System_CAPS_pubpropertyToolTipIcon

Gets or sets a value that defines the type of icon to be displayed alongside the ToolTip text.

System_CAPS_pubpropertyToolTipTitle

Gets or sets a title for the ToolTip window.

System_CAPS_pubpropertyUseAnimation

Gets or sets a value determining whether an animation effect should be used when displaying the ToolTip.

System_CAPS_pubpropertyUseFading

Gets or sets a value determining whether a fade effect should be used when displaying the ToolTip.

NameDescription
System_CAPS_pubmethodCanExtend(Object)

Returns true if the ToolTip can offer an extender property to the specified target component.

System_CAPS_pubmethodCreateObjRef(Type)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodDispose()

Releases all resources used by the Component.(Inherited from Component.)

System_CAPS_protmethodDispose(Boolean)

Releases the unmanaged resources used by the Component and optionally releases the managed resources.(Overrides Component.Dispose(Boolean).)

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Releases the unmanaged resources and performs other cleanup operations before the Cursor is reclaimed by the garbage collector.(Overrides Component.Finalize().)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetLifetimeService()

Retrieves the current lifetime service object that controls the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_protmethodGetService(Type)

Returns an object that represents a service provided by the Component or by its Container.(Inherited from Component.)

System_CAPS_pubmethodGetToolTip(Control)

Retrieves the ToolTip text associated with the specified control.

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodHide(IWin32Window)

Hides the specified ToolTip window.

System_CAPS_pubmethodInitializeLifetimeService()

Obtains a lifetime service object to control the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone(Boolean)

Creates a shallow copy of the current MarshalByRefObject object.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodRemoveAll()

Removes all ToolTip text currently associated with the ToolTip component.

System_CAPS_pubmethodSetToolTip(Control, String)

Associates ToolTip text with the specified control.

System_CAPS_pubmethodShow(String, IWin32Window)

Sets the ToolTip text associated with the specified control, and displays the ToolTip modally.

System_CAPS_pubmethodShow(String, IWin32Window, Int32)

Sets the ToolTip text associated with the specified control, and then displays the ToolTip for the specified duration.

System_CAPS_pubmethodShow(String, IWin32Window, Int32, Int32)

Sets the ToolTip text associated with the specified control, and then displays the ToolTip modally at the specified relative position.

System_CAPS_pubmethodShow(String, IWin32Window, Int32, Int32, Int32)

Sets the ToolTip text associated with the specified control, and then displays the ToolTip for the specified duration at the specified relative position.

System_CAPS_pubmethodShow(String, IWin32Window, Point)

Sets the ToolTip text associated with the specified control, and then displays the ToolTip modally at the specified relative position.

System_CAPS_pubmethodShow(String, IWin32Window, Point, Int32)

Sets the ToolTip text associated with the specified control, and then displays the ToolTip for the specified duration at the specified relative position.

System_CAPS_protmethodStopTimer()

Stops the timer that hides displayed ToolTips.

System_CAPS_pubmethodToString()

Returns a string representation for this control.(Overrides Component.ToString().)

NameDescription
System_CAPS_pubeventDisposed

Occurs when the component is disposed by a call to the Dispose method. (Inherited from Component.)

System_CAPS_pubeventDraw

Occurs when the ToolTip is drawn and the OwnerDraw property is set to true and the IsBalloon property is false.

System_CAPS_pubeventPopup

Occurs before a ToolTip is initially displayed. This is the default event for the ToolTip class.

With the ToolTip class, you can provide hints to a user when the user places the pointer on a control. The ToolTip class is typically used to alert users to the intended use of a control. For example, you can specify ToolTip text for a TextBox control that accepts a name, specifying the format of the name to be typed into the control. In addition to providing hints, you can also use the ToolTip class to provide run time status information. For example, you can use the ToolTip class to display connection speed and line quality data when the user moves the pointer onto a PictureBox control that displays Internet connection status.

The ToolTip class can be used in any container. To explicitly specify a container, use the ToolTip(IContainer) constructor. A single ToolTip component typically is used to create ToolTips for multiple controls on a single form. After you create a ToolTip, use a separate call to the SetToolTip method to associate ToolTip display text to an individual control. Then when the user moves the pointer on a control, the ToolTip with its text is displayed. You can call SetToolTip more than once for the same control to change the text that is associated with the control. To get the text that is associated with a control, use the GetToolTip method. To remove all ToolTip text associations with an instance of the ToolTip class, use the RemoveAll method.

System_CAPS_noteNote

ToolTip text is not displayed for controls that are disabled. Unless the ShowAlways property is set to true, ToolTips are not displayed when their container is inactive.

The ToolTip class provides the following properties and methods to modify the default behavior and appearance of a ToolTip.

Category

Associated members

Manual display

Active, Show, Hide, ShowAlways, Popup, StopTimer

ToolTip timing

AutoPopDelay, InitialDelay, ReshowDelay, AutomaticDelay, StopTimer

Content

SetToolTip, GetToolTip, StripAmpersands, ToolTipIcon, ToolTipTitle, RemoveAll

Appearance

BackColor, ForeColor, IsBalloon, OwnerDraw, UseAnimation, UseFading

If you want to disable all ToolTip text so that it cannot be displayed in your application, you can use the Active property. Usually the ToolTip is drawn by the operating system, but to customize the appearance of the ToolTip, you can set the OwnerDraw property to true and handle the Draw event.

The ToolTipTitle class implements the System.ComponentModel.IExtenderProvider interface, which has a single method, CanExtend. ToolTips extend controls on the same form at design time, adding a ToolTip property. For more information about extender providers, see Extender Providers.

The following code example creates an instance of the ToolTip class and associates the instance with the Form that the instance is created within. The code then initializes the delay properties AutoPopDelay, InitialDelay, and ReshowDelay. In addition the instance of the ToolTip class sets the ShowAlways property to true to enable ToolTip text to always be display regardless of whether the form is active. Finally, the example associates ToolTip text with two controls on a form, a Button and a CheckBox. The code example requires that the method defined in the example is located within a Form that contains a Button control named button1 and a CheckBox control named checkBox1, and that the method is called from the constructor of the Form.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft