In this article we will look into as how to display tooltip on labels.
The label control in windows forms doesn't have any tool tip property.However, in certain cases we may need to show the tool tip in label.In this article we will look into as how to display tool tip on labels.
Straight to experiment
We will discuss two aspects as how to set tool tip - one at design time and the other dynamically.
Add tooltip at design time
First of all select the ToolTip control
Then add the ToolTip control on to the form
Then drag and drop a label control and we will find the tooltip property
Write something and then run the application
Add tool tip dynamically
Add a label control to the form.Then in the form load event write the below code
private void Form1_Load(object sender, EventArgs e)
System.Windows.Forms.ToolTip tooltip = new System.Windows.Forms.ToolTip();
tooltip.IsBalloon = true;
tooltip.ShowAlways = true;
tooltip.SetToolTip(label2, "This is a dynamic tooltip");
This will display a balloon tooptip on the label2 whose content is set dynamically.
So this article has demonstrated as how to add tool tip to label controls.The same is applicable for other controls also.Hope this will be helpful.Thanks for reading.Zipped file is attached.