Associate Tooltip with WinForm Controls C#

There’s no direct property like ToolTip is available in WinForm, so you have to create an instance of the ToolTip class and assign captions to the various controls of the form using the same object.

private void Form1_Load(object sender, EventArgs e)
{
         // Create the ToolTip and associate with the Form container.
         ToolTip toolTip = new ToolTip();

         // Set up the delays for the ToolTip.
         toolTip.AutoPopDelay = 5000;
         toolTip.InitialDelay = 1000;
         toolTip.ReshowDelay = 500;
         // Force the ToolTip text to be displayed whether or not the form is active.
         toolTip.ShowAlways = true;

         // Set up the ToolTip text for the Button and Checkbox.
         toolTip.SetToolTip(this.button1, "My button1");
         toolTip.SetToolTip(this.checkBox1, "My checkBox1");
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s