The ToolTip is a single WinForms control that handles displaying tool tips for multiple elements on a single form.
Say your button is called MyButton.
- Add a ToolTip control (under Common
Controls in the Windows Forms
toolbox) to your form.
- Give it a
name - say MyToolTip
- Set the "Tooltip on MyToolTip" property of MyButton (under Misc in
the button property grid) to the text that should appear when you hover over it.
The tooltip will automatically appear when the cursor hovers over the button, but if you need to display it programmatically, call
MyToolTip.Show("Tooltip text goes here", MyButton);
in your code to show the tooltip, and
MyToolTip.Hide(MyButton);
to make it disappear again.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…