Find node clicked under context menu

前端 未结 10 1483
故里飘歌
故里飘歌 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:15

    Reviving this question because I find this to be a much better solution. I use the NodeMouseClick event instead.

    void treeview_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
    {
        if( e.Button == MouseButtons.Right )
        {
            tree.SelectedNode = e.Node;
        }
    }
    

提交回复
热议问题