开发者

How does ToolTip show Popup on a control?

When set a TooltipText on a control, and the tooltip text will be shown when user move mouse on the control. Tooltip 开发者_运维知识库will detect MouseEnter or MouseLeave or anything for this purpose?

I want to know how does a Tooltip show Popup on a control?

Assume that I have a user control with name 'UserControlX'. On UserControlX, I put a button and set Dock property to Fill. I add a UserControlX on Form1, add a ToolTip and set a text to this usercontrol. ToolTip will be not shown when user move mouse on control because user is moving mouse on usercontrol's button, not usercontrol, so the tooltip will never show.

Please help me how to solve this problem so that when move mouse on UserControlX, the tooltip will be shown. Thanks.


I believe the tooltip displaying on mouse-over is defined within the control's default template. if you view the default template you will likely see a reference to a tooltip in there. If you go further and view the Tooltip's default template, you will see how it is composed as well as what events it listens to.

To answer your question, you could do what Adrian suggests and put the tooltip on the button as well as the parent control.

If you have time to mess around a bit, you COULD try to see if there is a tooltip displayed event or something to that effect for the button, and then simply invoke the parent control's tooltip manually. It could be considered a hack, but worth a try, maybe.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜