WinForm中ToolTip的问题:如何让它永远显示,除非鼠标移开.

popcorn 2006-03-13 05:26:05
移到控件上就显示,鼠标移开就消失,而不是放上去后过几秒就消失了.
修改了所有的属性,好象都没用啊.
...全文
1840 24 打赏 收藏 转发到动态 举报
写回复
用AI写文章
24 条回复
切换为时间正序
请发表友善的回复…
发表回复
firetaker 2010-06-22
  • 打赏
  • 举报
回复
Knight94 2006-03-21
  • 打赏
  • 举报
回复
我估计MS也发现这一点了,其实在2.0中,ToolTip Class已经很完善了,而且你可以在它的基础上进行个性化的扩展。
Knight94 2006-03-21
  • 打赏
  • 举报
回复 1
而且我也测试出,AutoPopDelay的值不能超过33000,估计它的取值范围应该是小于32767(小于2的15次方),当大于这个值的话,这个值就用默认值5000来代替。

假如你的需求要延迟更长的时间,那么用本身的tooltip是不行的,你需要自己去写。
wuyi8808 2006-03-21
  • 打赏
  • 举报
回复
目前版本的M$.NET的ToolTip好象不能实现楼主的要求,期待.NET SDK 3.0吧。
Knight94 2006-03-21
  • 打赏
  • 举报
回复
如下是可以的,我已经试过,延迟时间超过基本上是25秒
toolTip1.AutoPopDelay = 25000;
toolTip1.InitialDelay = 1000;
toolTip1.ReshowDelay = 0;
// 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( btnDConvert, "My button1");
popcorn 2006-03-20
  • 打赏
  • 举报
回复
晕死,大家最好试一下再来回答问题.
如果能做早就做了,就是不能做才上来问问.
能把显示时间延长到20秒以上就给分了.
Knight94 2006-03-20
  • 打赏
  • 举报
回复
在msdn中,查看tooltip,你可以找到相关的sample
Knight94 2006-03-20
  • 打赏
  • 举报
回复
sample
http://chs.gotdotnet.com/quickstart/util/srcview.aspx?path=/quickstart/winforms/Samples/ControlReference/ToolTipCtl/ToolTipCtl.src&file=CS\ToolTipCtl.cs&font=3
lzt7 2006-03-16
  • 打赏
  • 举报
回复
好像这样没什么意义啊
popcorn 2006-03-14
  • 打赏
  • 举报
回复
奇怪,是说得不明白还是理解力差?
鼠标移上去才提示,移开就消失啊.或者让ToolTip能显示长些时间也行.
自己做很麻烦的,因为ToolTip可以在窗口之外的地方显示.还有自适应性.
popcorn 2006-03-14
  • 打赏
  • 举报
回复
能延长也行啊,问题是再怎么延长也不过十秒就消失了.不信试试.
lookatliu 2006-03-14
  • 打赏
  • 举报
回复
1.1也有的啊……但是lz要求一直显示而不是延长阿
jingyl 2006-03-14
  • 打赏
  • 举报
回复
这是VS2005 MSDN ,FW2.0中的一段示例,可能1.1中不一定有,你可以参考一下其实现:

AutoPopDelay 属性使您可以缩短或延长指针位于控件上时 ToolTip 窗口的显示时间。例如,如果在工具提示窗口中显示大量帮助信息,就可以增加此属性的值,以确保用户有足够的时间阅读文本。

如果需要一致的“工具提示”窗口延迟模式,则可以设置 AutomaticDelay 属性。AutomaticDelay 属性将 AutoPopDelay、ReshowDelay 和 InitialDelay 三个属性设置为基于单个值的初始值。每次设置 AutomaticDelay 属性时,AutoPopDelay 属性就会被设置为 AutomaticDelay 属性值的 10 倍。在设置 AutomaticDelay 属性以后,就可以独立设置 AutoPopDelay 属性(重写默认值)。

弹出提示的最大可延迟时间是 5000 毫秒。如需更长的持续时间,请使用 Show 方法控制显示工具提示的精确时间。


// This example assumes that the Form_Load event handling method
// is connected to the Load event of the form.
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");
}
lookatliu 2006-03-14
  • 打赏
  • 举报
回复
刚刚那个属性是不行的,偶搞错了,sorry。
也许是客户的要求吧……有些客户要求很bt的。
jiezhi 2006-03-14
  • 打赏
  • 举报
回复
根本没有必要为这样的问题费时间。

你将信息显示在window某个固定的地方不就行了吗,比如状态栏,或者使用一个新窗口,令用户可以固定显示它,就如同金山词霸。

lookatliu 2006-03-14
  • 打赏
  • 举报
回复
toolTip1.ShowAlways = true;
这个不行嘛??
raulredondo 2006-03-13
  • 打赏
  • 举报
回复
那还不如用别的做,否则一块东西老是漂在Form上面,别的控件怎么看啊
一直显示就不是ToolTip了
jetxia 2006-03-13
  • 打赏
  • 举报
回复
2*啊,你都不知道
lidong6 2006-03-13
  • 打赏
  • 举报
回复
自己做一个吧.这个时候用ToolTip也没什么意义了.
WindowsBoy 2006-03-13
  • 打赏
  • 举报
回复
自己做一个假的呗! 不知道行不行,应该比较麻烦!
用LABel做,然后根据鼠标的位置,设置label显示的位置!
加载更多回复(4)

110,567

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧