System.Windows.Forms.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.

See Also: ToolTip Members

Syntax

[System.ComponentModel.ToolboxItemFilter("System.Windows.Forms", System.ComponentModel.ToolboxItemFilterType.Allow)]
[System.ComponentModel.ProvideProperty("ToolTip", typeof(System.Windows.Forms.Control))]
[System.ComponentModel.DefaultEvent("Popup")]
public class ToolTip : System.ComponentModel.Component, System.ComponentModel.IExtenderProvider

Remarks

With the System.Windows.Forms.ToolTip class, you can provide hints to a user when the user places the pointer on a control. The System.Windows.Forms.ToolTip class is typically used to alert users to the intended use of a control. For example, you can specify ToolTip text for a System.Windows.Forms.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 System.Windows.Forms.ToolTip class to provide run time status information. For example, you can use the System.Windows.Forms.ToolTip class to display connection speed and line quality data when the user moves the pointer onto a System.Windows.Forms.PictureBox control that displays Internet connection status.

The System.Windows.Forms.ToolTip class can be used in any container. To explicitly specify a container, use the ToolTip.#ctor(System.ComponentModel.IContainer) constructor. A single System.Windows.Forms.ToolTip component typically is used to create ToolTips for multiple controls on a single form. After you create a System.Windows.Forms.ToolTip, use a separate call to the ToolTip.SetToolTip(Control, string) 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 ToolTip.SetToolTip(Control, string) 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 ToolTip.GetToolTip(Control) method. To remove all ToolTip text associations with an instance of the System.Windows.Forms.ToolTip class, use the ToolTip.RemoveAll method.

Note:

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

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

Manual display

ToolTip.Active, erload:System.Windows.Forms.ToolTip.Show, ToolTip.Hide(IWin32Window), ToolTip.ShowAlways, ToolTip.Popup, ToolTip.StopTimer

ToolTip timing

ToolTip.AutoPopDelay, ToolTip.InitialDelay, ToolTip.ReshowDelay, ToolTip.AutomaticDelay, ToolTip.StopTimer

Content

ToolTip.SetToolTip(Control, string), ToolTip.GetToolTip(Control), ToolTip.StripAmpersands, ToolTip.ToolTipIcon, ToolTip.ToolTipTitle, ToolTip.RemoveAll

Appearance

ToolTip.BackColor, ToolTip.ForeColor, ToolTip.IsBalloon, ToolTip.OwnerDraw, ToolTip.UseAnimation, ToolTip.UseFading

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

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

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0