Windows Forms 2.0 – The Tooltip Control

Posted by: Suprotim Agarwal , on 3/23/2007, in Category WinForms & WinRT
Views: 20019
Abstract: In this article, we will explore how to perform some common tasks using the Tooltip Control of Windows Forms 2.0.
Windows Forms 2.0 – The Tooltip Control
A ToolTip Control is a small rectangular pop-up window, that appears with an explanatory text when the user hovers the pointer over a control or window. A ToolTip can be associated with any control. Once this  component is added to a form, the other controls on that form get a special ToolTip property.
How Do I Get Started With The ToolTip Control
ToolTip text is not displayed for controls that are disabled.
With the ToolTip class, you can provide quick help to a user when the mouse rests on an item as shown in the Figure --- below. The SetToolTip method connects a tooltip with a control. Similarly to get the text that is associated with a control, use the GetToolTip method. The Tooltip control provides three important properties for Tooltip timing : AutoPopDelay, InitialDelay, and ReshowDelay. AutoPopDelay sets the period of time the ToolTip remains visible if the pointer is stationary on a control with specified ToolTip text. The InitialDelay sets the time that passes before the ToolTip appears. Reshow Delay sets the length of time that must transpire before subsequent ToolTip windows appear as the pointer moves from one control to another
The following code example creates an instance of the ToolTip class and associates the ToolTip text with a Button (btnDefaulttip). The code also initializes the delay properties AutoPopDelay, InitialDelay, and ReshowDelay.
private void CreateToolTip()
// Create default ToolTip
tip = new ToolTip();
// Set up the delays for the ToolTip.
tip.AutoPopDelay = 2000;
tip.InitialDelay = 500;
tip.ReshowDelay = 500;
// For Tooltip to be displayed irrespective of the the form being active/inactive set,
// tip.ShowAlways = true;
// Create btnDefaultTip and set initial values.
this.btnDefaultTip = new System.Windows.Forms.Button();
this.btnDefaultTip.Location = new System.Drawing.Point(56, 83);
this.btnDefaultTip.Size = new System.Drawing.Size(140, 23);
this.btnDefaultTip.Text = "Default";
// Set ToolTip for the button
tip.SetToolTip(btnDefaultTip, "A Button Tooltip");
Conclusion :
In this article, we took a quick overview of the Tooltip Control. I hope the article was useful and I thank you for viewing it.

This article has been editorially reviewed by Suprotim Agarwal.

Absolutely Awesome Book on C# and .NET

C# and .NET have been around for a very long time, but their constant growth means there’s always more to learn.

We at DotNetCurry are very excited to announce The Absolutely Awesome Book on C# and .NET. This is a 500 pages concise technical eBook available in PDF, ePub (iPad), and Mobi (Kindle).

Organized around concepts, this Book aims to provide a concise, yet solid foundation in C# and .NET, covering C# 6.0, C# 7.0 and .NET Core, with chapters on the latest .NET Core 3.0, .NET Standard and C# 8.0 (final release) too. Use these concepts to deepen your existing knowledge of C# and .NET, to have a solid grasp of the latest in C# and .NET OR to crack your next .NET Interview.

Click here to Explore the Table of Contents or Download Sample Chapters!

What Others Are Reading!
Was this article worth reading? Share it with fellow developers too. Thanks!
Share on LinkedIn
Share on Google+

Suprotim Agarwal, MCSD, MCAD, MCDBA, MCSE, is the founder of DotNetCurry, DNC Magazine for Developers, SQLServerCurry and DevCurry. He has also authored a couple of books 51 Recipes using jQuery with ASP.NET Controls and The Absolutely Awesome jQuery CookBook.

Suprotim has received the prestigious Microsoft MVP award for ten consecutive times. In a professional capacity, he is the CEO of A2Z Knowledge Visuals Pvt Ltd, a digital group that offers Digital Marketing and Branding services to businesses, both in a start-up and enterprise environment.

Get in touch with him on Twitter @suprotimagarwal or at LinkedIn

Page copy protected against web site content infringement 	by Copyscape

Feedback - Leave us some adulation, criticism and everything in between!
Comment posted by swamy on Wednesday, September 2, 2009 2:43 AM
useful article, many thanks
Comment posted by prashanth on Saturday, June 5, 2010 10:44 AM
easy to make understand
thank you very much