0
我在代碼中動態生成一對treeview控件,並將所有treeview指向同一個SelectedNodeChanged事件。但是,在這種情況下,我無法獲取包含被單擊節點的特定樹視圖。從EventArgs中獲取特定的樹視圖
for (int i = 0; i < numTree; i++)
{
treeList[i] = new TreeView();
treeList[i].SelectedNodeChanged += TreeSelectedNodeChanged;
}
private void TreeSelectedNodeChanged(object sender, EventArgs e)
{
// cannot call treeList[i] since all treeview should direct to this event
Message.Text = "You selected: " + treeList[i].SelectedNode.Text;
}
如有任何意見,將不勝感激!
行之有效!非常感謝! – user3081703