C#:如何将工具提示添加到一个控制? [英] C#: How do I add a ToolTip to a control?

查看:112
本文介绍了C#:如何将工具提示添加到一个控制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些,我想显示工具提示当鼠标悬停在它的控制。我怎样才能做到这一点?我想知道如何做到这一点正确的代码,而且在设计师(有一个在工具箱中的工具提示组件,但我不太..得到它)。

I have some controls that I would like to display a ToolTip for when the mouse is hovering over it. How can I do this? I would like to know how to do this properly in code, but also in the designer (There is a ToolTip component in the toolbox, but I don't quite.. get it).

我也不会感到惊讶,如果这是一个重复的,但我只能找到那些更先进的,具体的方案问题。我想知道的基本知识。

推荐答案

此处是你的代码做的文章

private void Form1_Load(object sender, System.EventArgs e)
{
         // Create the ToolTip and associate with the Form container.
         ToolTip toolTip1 = new ToolTip();

         // Set up the delays for the ToolTip.
         toolTip1.AutoPopDelay = 5000;
         toolTip1.InitialDelay = 1000;
         toolTip1.ReshowDelay = 500;
         // Force the ToolTip text to be displayed whether or not the form is active.
         toolTip1.ShowAlways = true;

         // Set up the ToolTip text for the Button and Checkbox.
         toolTip1.SetToolTip(this.button1, "My button1");
         toolTip1.SetToolTip(this.checkBox1, "My checkBox1");
}

这篇关于C#:如何将工具提示添加到一个控制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆