C# 鼠标结束时的按钮提示

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11322841/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-09 17:24:21  来源:igfitidea点击:

Button tip when Mouse is over

c#winformsbutton

提问by Leonardo

I have a simple question ! I'd like to know how to add like a tip when the user puts his mouse over a button, like that like grey box that appears right below the button. I'm using Windows Form !

我有一个简单的问题 !我想知道如何在用户将鼠标放在按钮上时添加提示,就像出现在按钮正下方的灰色框一样。我正在使用 Windows 窗体!

P.S-> I know it's obsolete and we now have WPF but I'm using Form !

PS-> 我知道它已经过时了,我们现在有了 WPF 但我正在使用 Form !

Thanks !

谢谢 !

采纳答案by Habib

Use ToolTipon the button. Like.

使用按钮上的工具提示。喜欢。

System.Windows.Forms.ToolTip ToolTip1 = new System.Windows.Forms.ToolTip();
ToolTip1.SetToolTip(this.Button1, "Button Info");

Or you can:
Add a ToolTip control to your form, Name it ToolTip1.
Add text for tooltip to the "ToolTip on ToolTip1" property of the button.

或者您可以:
将 ToolTip 控件添加到您的窗体中,将其命名为 ToolTip1。
将工具提示文本添加到按钮的“ToolTip1 上的工具提示”属性中。