Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Tooltip In C#
WhatsApp
Mahesh Chand
6y
471.9k
0
9
100
Article
ToolTipSampleInCSharp.zip
A tooltip is a small pop-up window that displays some information when you rollover on a control.
In this article, I will discuss how to create and use a Tooltip control in a Windows Forms application using Visual Studio 2010. After that, I will discuss various properties and methods available for the Tooltip control.
Creating a Tooltip
Tooltip class represents a tooltip control. Once a Tooltip object is created, we need to call SetToolTip method and pass a control and text. The following code snippet creates a Tooltip and attaches to a Button control using SetToolTip method.
ToolTip toolTip1 = newToolTip();
toolTip1.ShowAlways =
true
;
toolTip1.SetToolTip(button1,
"Click me to execute."
);
If you rollover on Button control, you will see the following output.
Figure 1
Tooltip Properties
Active - A tooltip is currently active.
AutomaticDelay - Automatic delay for the tooltip.
AutoPopDelay - The period of time the ToolTip remains visible if the pointer is stationary on a control with specified ToolTip text.
InitialDelay - Gets or sets the time that passes before the ToolTip appears.
IsBaloon - Gets or sets a value indicating whether the ToolTip should use a balloon window.
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 - Displays if tooltip is displayed even if the parent control is not active.
ToolTipIcon - Icon of tooltip window.
ToolTipTitle - Title of tooltip window.
UseAnimation - Represents whether an animation effect should be used when displaying the tooltip.
UseFading - Represents whether a fade effect should be used when displaying the tooltip.
The following code snippet sets some of these properties.
ToolTip buttonToolTip = newToolTip();
buttonToolTip.ToolTipTitle =
"Button Tooltip"
;
buttonToolTip.UseFading =
true
;
buttonToolTip.UseAnimation =
true
;
buttonToolTip.IsBalloon =
true
;
buttonToolTip.ShowAlways =
true
;
buttonToolTip.AutoPopDelay = 5000;
buttonToolTip.InitialDelay = 1000;
buttonToolTip.ReshowDelay = 500;
buttonToolTip.SetToolTip(button1,
"Click me to execute."
);
Balloon Tooltip
By setting IsBalloon to true it makes a tooltip balloon that looks like Figure 2.
Figure 2
Summary
In this article, we discussed how to create a Tooltip control in Windows Forms and set its various properties.
C#
Tooltip Control
Tooltips
Up Next
Ebook Download
View all
Frontend Developer Interview Questions and Answers
Read by 951 people
Download Now!
Learn
View all
Mindcracker
Founded in 2003, Mindcracker is the authority in custom software development and innovation. We put best practices into action. We deliver solutions based on consumer and industry analysis.
Membership not found