显示工具提示使用过Windows窗体按钮
答
工具提示实际上是一个WinForms控制处理为单一形式的多个元素显示工具提示。
The ToolTip is actually a WinForms control that handles displaying tool tips for multiple elements on a single form.
假设你的按钮被称为用作MyButton。
Say your button is called MyButton.
- 添加工具提示控制(通用下 在Windows窗体控件 工具箱中)到表单中。
- 给它一个 名字 - 说MyToolTip
- 将工具提示上MyToolTip杂项下用作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 programatically, call
MyToolTip.Show("Tooltip text goes here", MyButton)
在code键来显示工具提示,并MyToolTip.Hide(用作MyButton),以使其再次消失。
in your code to show the tooltip, and MyToolTip.Hide(MyButton) to make it disappear again.