C#treeview我单击子节点的同时怎么获取父节点值

2024-12-05 04:49:12
推荐回答(1个)
回答1:

在 NodeMouseClick事件中 写
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
MessageBox.Show(treeView1.SelectedNode.Parent.Text);
}