vb.net 在悬停时在控件上创建提示气球?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5545257/
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-09-09 15:24:28  来源:igfitidea点击:

creating a tip balloon over a control on hover?

vb.net

提问by John Kapsis

I simply want when someone hovers his mouse over a checkbox a "tip balloon" to appear describing what the control does?

我只是希望当有人将鼠标悬停在复选框上时会出现一个“提示气球”来描述控件的作用?

How can this be done?

如何才能做到这一点?

Using VB.NET with Visual Studio 2010.

在 Visual Studio 2010 中使用 VB.NET。

回答by MusiGenesis

Drag a ToolTipcontrol from the toolbox on the left onto your form (the designer will then put it below your form, since it's not meant to be visible normally). By default it will be named "tooltip1".

ToolTip控件从左侧的工具箱拖到您的表单上(然后设计者会将其放在您的表单下方,因为它通常不应该是可见的)。默认情况下,它将被命名为“tooltip1”。

Then select your checkbox and go over to its properties window. You should see a property labeled "Tooltip on tooltip1" - set this to whatever you want. When you run the app and hold the mouse over your checkbox, you should see the tooltip text.

然后选择您的复选框并转到其属性窗口。您应该会看到一个标记为“tooltip1 上的工具提示”的属性 - 将其设置为您想要的任何内容。当您运行应用程序并将鼠标悬停在复选框上时,您应该会看到工具提示文本。

回答by Zian Choy

For WinForms, see Display a tooltip over a button using Windows Forms, or briefly stated...

对于 WinForms,请参阅使用 Windows 窗体在按钮上显示工具提示,或简要说明...

  1. Drag in a ToolTip.
  2. this.toolTip1.SetToolTip(this.targetControl, "My Tool Tip")
  1. 拖入工具提示。
  2. this.toolTip1.SetToolTip(this.targetControl, "我的工具提示")

For WPF:

对于 WPF:

 <Button>Click Me
            <Button.ToolTip>
                <ToolTip>Blob of text.
                </ToolTip>
            </Button.ToolTip>
        </Button>

回答by raymond

tooltip1.show("Your text", then your control)