TreeViewExample
namespace TreeViewExample
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
//string strParentNode = e.Node.Text;
string strParentNode = this.treeView1.SelectedNode.Name; //获取树节点的名称
MessageBox.Show(strParentNode);
}
}
}
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
//string strParentNode = e.Node.Text;
string strParentNode = this.treeView1.SelectedNode.Name; //获取树节点的名称
MessageBox.Show(strParentNode);
}
}
}