如果单击树视图中的childnode,我需要在c#Windows应用程序中使用其他形式 [英] if click a childnode in a treeview i need to go another form in c# windows application
本文介绍了如果单击树视图中的childnode,我需要在c#Windows应用程序中使用其他形式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果单击树形视图中的子节点,我需要在c#Windows应用程序中使用其他形式
if click a childnode in a treeview i need to go another form in c# windows application
推荐答案
尝试类似以下操作:
Try something like this:
private void Form1_Load(object sender, EventArgs e)
{
PopulateTreeView();
this.treeView1.DoubleClick += new EventHandler(treeView1_DoubleClick);
}
private void treeView1_DoubleClick(object sender, EventArgs e)
{
TreeView tView = (TreeView)sender;
switch (tView.SelectedNode.Text)
{
case "Dog":
MessageBox.Show("Open the window related to Dog");
break;
case "Cat":
MessageBox.Show("Open the window related to Cat");
break;
case "Monkey":
MessageBox.Show("Open the window related to Monkey");
break;
}
}
这篇关于如果单击树视图中的childnode,我需要在c#Windows应用程序中使用其他形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文