Find node clicked under context menu

前端 未结 10 1484
故里飘歌
故里飘歌 2020-11-30 21:49

How can I find out which node in a tree list the context menu has been activated? For instance right-clicking a node and selecting an option from the menu.

I can\'t

10条回答
  •  失恋的感觉
    2020-11-30 22:23

    Another option you could run with is to have a global variable that has the selected node. You would just need to use the TreeNodeMouseClickEventArgs.

    public void treeNode_Click(object sender, TreeNodeMouseClickEventArgs e)
    {
        _globalVariable = e.Node;
    }
    

    Now you have access to that node and it's properties.

提交回复
热议问题