A ToolTip provides a small rectangular pop-up window that provides a brief description of a control's purpose when the pointer is touching the control.
Properties: (some of them)
This is the background color for the ToolTip.
This is the foreground color for the ToolTip.
This is the length of time, a number of milliseconds, that the pointer must remain stationary on the control before the ToolTip pop-up window will appear.
This is the length of time, a number of milliseconds, for which the ToolTip window will remain visible.
As the pointer moves from one control to another, this is the amount of time, a number of milliseconds, between the appearance of ToolTip windows.
This indicates whether the ToolTip is active (true) or not (false).
This indicates whether the ToolTip will be drawn by the operating system (false) or by code we provide (true).
Methods: (just a couple)
This associates the ToolTip with control C and provides the text Caption to be displayed.
This returns the text associated with control C).
Example: (from an MSDN page)
// This example assumes that the Form_Load event handling method
// is connected to the Load event of the form.
private void Form1_Load(object sender, System.EventArgs e)
{
// Create the ToolTip and associate with the Form container.
ToolTip toolTip1 = new ToolTip();
// Set up the delays for the ToolTip.
toolTip1.AutoPopDelay = 5000;
toolTip1.InitialDelay = 1000;
toolTip1.ReshowDelay = 500;
// Set up the ToolTip text for the Button and Checkbox.
toolTip1.SetToolTip(this.button1, "My button1");
toolTip1.SetToolTip(this.checkBox1, "My checkBox1");
}
End of Example
Notes
Notice that in the example we have one ToolTip instance for this form and use it for two controls. Presumably if we wanted different ToolTip windows to have different timing, we could have more than one ToolTip instance.
Why would we want to write our own code to draw the ToolTip window? One reason might be that we want to specify the font used.