Windows Forms toolTip forever using C#

自闭症网瘾萝莉.ら 提交于 2019-12-13 05:12:55

问题


How do I set a toolTip that doesn't go away as long as you're hovering on the control?

I tried setting the "AutoPopDelay" to 999999, but the tooltip disappears after 15 seconds.

Or, is there another way to achieve the same effect?


回答1:


From MSDN:

There are multiple delay values that you can set for a Windows Forms ToolTip component. The unit of measure for all these properties is milliseconds. The InitialDelay property determines how long the user must point at the associated control for the ToolTip string to appear. The ReshowDelay property sets the number of milliseconds it takes for subsequent ToolTip strings to appear as the mouse moves from one ToolTip-associated control to another. The AutoPopDelay property determines the length of time the ToolTip string is shown. You can set these values individually, or by setting the value of the AutomaticDelay property; the other delay properties are set based on the value assigned to the AutomaticDelay property. For example, when AutomaticDelay is set to a value N, InitialDelay is set to N, ReshowDelay is set to the value of AutomaticDelay divided by five (or N/5), and AutoPopDelay is set to a value that is five times the value of the AutomaticDelay property (or 5N).

For more information on this subject, look here:

  • ToolTip Class

  • Make tooltips remain visible for a very long time in Visual Basic .NET

  • Stack Overflow question Can I set an infinite AutoPopDelay for a tooltip in a .NET Windows Forms window?

  • Tooltips with infinite timeout?




回答2:


This is what worked for me:

AutoPopDelay = 32767 MSDN states this is Int32, but anything over 32767 will fail.

InitialDelay = 200

ReshowDelay = 200

This should make the tooltip be shown for as long as possible. I hope it helped.



来源:https://stackoverflow.com/questions/2530841/windows-forms-tooltip-forever-using-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!