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.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Thetype exposes the following members.
|Active||Gets or sets a value indicating whether the ToolTip is currently active.|
|AutomaticDelay||Gets or sets the automatic delay for the ToolTip.|
|AutoPopDelay||Gets or sets the period of time the ToolTip remains visible if the pointer is stationary on a control with specified ToolTip text.|
|BackColor||Gets or sets the background color for the ToolTip.|
|CanRaiseEvents||Gets a value indicating whether the component can raise an event. (Inherited from Component.)|
|Container||Gets the IContainer that contains the Component. (Inherited from Component.)|
|CreateParams||Infrastructure. Gets the creation parameters for the ToolTip window.|
|DesignMode||Gets a value that indicates whether the Component is currently in design mode. (Inherited from Component.)|
|Events||Gets the list of event handlers that are attached to this Component. (Inherited from Component.)|
|ForeColor||Gets or sets the foreground color for the ToolTip.|
|InitialDelay||Gets or sets the time that passes before the ToolTip appears.|
|IsBalloon||Gets or sets a value indicating whether the ToolTip should use a balloon window.|
|OwnerDraw||Gets or sets a value indicating whether the ToolTip is drawn by the operating system or by code that you provide.|
|ReshowDelay||Gets or sets the length of time that must transpire before subsequent ToolTip windows appear as the pointer moves from one control to another.|
|ShowAlways||Gets or sets a value indicating whether a ToolTip window is displayed, even when its parent control is not active.|
|Site||Gets or sets the ISite of the Component. (Inherited from Component.)|
|StripAmpersands||Gets or sets a value that determines how ampersand (&) characters are treated.|
|Tag||Gets or sets the object that contains programmer-supplied data associated with the .|
|ToolTipIcon||Gets or sets a value that defines the type of icon to be displayed alongside the ToolTip text.|
|ToolTipTitle||Gets or sets a title for the ToolTip window.|
|UseAnimation||Gets or sets a value determining whether an animation effect should be used when displaying the ToolTip.|
|UseFading||Gets or sets a value determining whether a fade effect should be used when displaying the ToolTip.|
|CanExtend||Returns true if the ToolTip can offer an extender property to the specified target component.|
|CreateObjRef||Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.)|
|Dispose||Releases all resources used by the Component. (Inherited from Component.)|
|Dispose(Boolean)||Disposes of the component. (Overrides Component.Dispose(Boolean).)|
|Equals(Object)||Determines whether the specified object is equal to the current object. (Inherited from Object.)|
|Finalize||Releases the unmanaged resources and performs other cleanup operations before the Cursor is reclaimed by the garbage collector. (Overrides Component.Finalize.)|
|GetHashCode||Serves as the default hash function. (Inherited from Object.)|
|GetLifetimeService||Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)|
|GetService||Returns an object that represents a service provided by the Component or by its Container. (Inherited from Component.)|
|GetToolTip||Retrieves the ToolTip text associated with the specified control.|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|Hide||Hides the specified ToolTip window.|
|InitializeLifetimeService||Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)|
|MemberwiseClone||Creates a shallow copy of the current Object. (Inherited from Object.)|
|MemberwiseClone(Boolean)||Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.)|
|RemoveAll||Removes all ToolTip text currently associated with the ToolTip component.|
|SetToolTip||Associates ToolTip text with the specified control.|
|Show(String, IWin32Window)||Sets the ToolTip text associated with the specified control, and displays the ToolTip modally.|
|Show(String, IWin32Window, Point)||Sets the ToolTip text associated with the specified control, and then displays the ToolTip modally at the specified relative position.|
|Show(String, IWin32Window, Int32)||Sets the ToolTip text associated with the specified control, and then displays the ToolTip for the specified duration.|
|Show(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.|
|Show(String, IWin32Window, Int32, Int32)||Sets the ToolTip text associated with the specified control, and then displays the ToolTip modally at the specified relative position.|
|Show(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.|
|StopTimer||Stops the timer that hides displayed ToolTips.|
|ToString||Returns a string representation for this control. (Overrides Component.ToString.)|
|Disposed||Occurs when the component is disposed by a call to the Dispose method. (Inherited from Component.)|
|Draw||Occurs when the ToolTip is drawn and the OwnerDraw property is set to true and the IsBalloon property is false.|
|Popup||Occurs before a ToolTip is initially displayed. This is the default event for the class.|
With the class, you can provide hints to a user when the user places the pointer on a control. The 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 class to provide run time status information. For example, you can use the 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 class can be used in any container. To explicitly specify a container, use the ToolTip(IContainer) constructor. A single component typically is used to create ToolTips for multiple controls on a single form. After you create a , 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 class, use the RemoveAll method.
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 class provides the following properties and methods to modify the default behavior and appearance of a ToolTip.
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 , 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 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 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.
' This example assumes that the Form_Load event handling method ' is connected to the Load event of the form. Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles MyBase.Load ' Create the ToolTip and associate with the Form container. Dim toolTip1 As New ToolTip() ' Set up the delays for the ToolTip. toolTip1.AutoPopDelay = 5000 toolTip1.InitialDelay = 1000 toolTip1.ReshowDelay = 500 ' Force the ToolTip text to be displayed whether or not the form is active. toolTip1.ShowAlways = True ' Set up the ToolTip text for the Button and Checkbox. toolTip1.SetToolTip(Me.button1, "My button1") toolTip1.SetToolTip(Me.checkBox1, "My checkBox1") End Sub