c#中的某些控件,本身就带有ToolTipText这个属性,通过设置该属性就可以设置其提示文本.但是有些控件,如Button,PictureBox等就没有这个属性,该怎么办呢? 可以使用类ToolTip来实现,下面为示例代码: 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");
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");
只要拖个toolTip控件,Button就会有个属性"toolTip1上的ToolTip";
不知道360那个悬浮样式如何做到的,动态的显示出来,还有个小图片,很美观;
就算没有一个人回我的帖子,我也照样可以让我的帖子置顶;
本人自有WG,无需up;
个人建议而已。
一个思路是用label,动态Update()这个label。不过可能会把背景破坏掉,挺烦了。
另外你看看楼上的提议,我没研究过。
参考:
关于悬浮窗口,会对做悬浮标签有点启发。
http://blog.csdn.net/guolei0451/archive/2006/10/05/1321393.aspx
关于tooltip使用方法
http://hi.baidu.com/wangzhe1945/blog/item/467cadfb80b921254e4aea5a.html
tooltip具体源码封装类
http://download.csdn.net/source/923763
这个注意不错,虽然麻烦了点,但比ToolTip多了许多可扩展功能;
说不定,360也是用一个Form做成这样的效果呢,呵呵....本贴暂时没有值得学习的地方;
那样的话你想怎么样设置风格随你。