在树视图节点文本上的提示 [英] Hint on treeview node text

查看:100
本文介绍了在树视图节点文本上的提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

树视图节点文本上是否有提示属性?

Is there a hint property on treeview node text?

推荐答案

您为树视图的ToolTip.Popup创建事件处理程序:
You create an event handler for ToolTip.Popup of the treeview:
private void ToolTip1_Popup(Object sender, PopupEventArgs e)


在此事件处理程序中,您将检索鼠标的当前位置,以便确定当前在其下的注释:


In this event handler you retrieve the current position of the mouse so you can determine the note that''s currently under it:

Point pt = PointToClient(Form.MousePosition);
TreeNode node = this.GetNodeAt(pt.X, pt.Y);




没有节点,可以设置工具提示文本并像什么都没有发生一样处理事件:




Not you have the node and can set the tooltip text and handle the event like nothing happend:

e.DrawBackground();
e.DrawBorder();
e.DrawText(); 



http://msdn.microsoft.com/en-us/library/system. windows.forms.drawtooltipeventhandler.aspx [ ^ ]

祝你好运!



http://msdn.microsoft.com/en-us/library/system.windows.forms.drawtooltipeventhandler.aspx[^]

Good luck!


这篇关于在树视图节点文本上的提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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