如何单击一个treenode然后发生了什么? [英] how to click one treenode then something happen?
本文介绍了如何单击一个treenode然后发生了什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,我是VB.NET中使用Treeview控件的新手,所以我遇到了一些问题...我想要的如下所示:
当我单击其中一个treenodes时,它将调用某些事件或其他事件,例如显示的一个消息框.
但是我不知道该怎么做.我发现没有关于treenodes的"click"事件...
请帮助或给我一些建议!非常感谢!
Hi,everyone,I''m new in using treeview control in VB.NET ,so I faced some problems about it...What I want is like below:
When I click one of the treenodes,it will call some event or others such as one messagebox displayed.
But I don''t know how to do this.I found that there was no "click" event about treenodes...
Plz help me or give me some suggestion!Thanks a lot!
推荐答案
不,Click事件是TreeView的一部分.
得到事件,确定它是哪个节点,然后离开...
No, the Click event is part of the TreeView.
You get the event, decide which node it is and off you go...
您可以尝试订阅 NodeMouseClick 的 AfterSelect 事件:
You can try subscribing to AfterSelect of NodeMouseClick events:
// Handle the After_Select event.
private void TreeView1_AfterSelect(System.Object sender,
System.Windows.Forms.TreeViewEventArgs e)
{
// Vary the response depending on which TreeViewAction
// triggered the event.
switch((e.Action))
{
case TreeViewAction.ByKeyboard:
MessageBox.Show("You like the keyboard!");
break;
case TreeViewAction.ByMouse:
MessageBox.Show("You like the mouse!");
break;
}
}
或
or
void treeView1_NodeMouseClick(object sender,
TreeNodeMouseClickEventArgs e)
{
textBox1.Text = e.Node.Text;
}
格里夫!谢谢您的回答,我想我必须了解有关树视图控件的更多信息……非常感谢!我会试着像你说的那样!
Hi,Griff!Thank you for your answer,I think that I must learn more about the treeview control...Thanks a lot! I will try like what you said!
这篇关于如何单击一个treenode然后发生了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文