Right Click Menu
-
I need help for the following purpose: Suppose I have a tree view and there are various items there. When I right click on a item it will display a menu which contains dynamic options in the menu. [I have tried by context menu strip. For my tree view I have chosen the contextmenustrip1. But problem is when i right click any where on the tree view it shows the menu with static items. But I need when i will right click on any node only at that moment it should appear with some option those are available in a listbox.(The list box is dynamic)]
-
I need help for the following purpose: Suppose I have a tree view and there are various items there. When I right click on a item it will display a menu which contains dynamic options in the menu. [I have tried by context menu strip. For my tree view I have chosen the contextmenustrip1. But problem is when i right click any where on the tree view it shows the menu with static items. But I need when i will right click on any node only at that moment it should appear with some option those are available in a listbox.(The list box is dynamic)]
Use the ContextMenuStrip.Opening event to modify the content of your menu.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones
-
Use the ContextMenuStrip.Opening event to modify the content of your menu.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones
Thanks for the help. Now I can make it dynamic. But How can I just do it only for selected node? I only want that when i will click to any node then it should display the menu. Otherwise it should not display the menu if i click any place of the tree view other than any node.
-
Thanks for the help. Now I can make it dynamic. But How can I just do it only for selected node? I only want that when i will click to any node then it should display the menu. Otherwise it should not display the menu if i click any place of the tree view other than any node.
You can rebuild the context menu every time you change selected node and just display it OR As suggested use the opening event and rebuild before opeing based on the currently selected node. You may also want to look into the hittest and mousedown to select the node when you right click on it. IIRC the right click does not select the node.
-
Thanks for the help. Now I can make it dynamic. But How can I just do it only for selected node? I only want that when i will click to any node then it should display the menu. Otherwise it should not display the menu if i click any place of the tree view other than any node.
private void yourTreeView\_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { ((TreeView)sender).SelectedNode = ((TreeView)sender).GetNodeAt(e.Location); }
We will either find a way, or make one! (\ /) (- .-) C(''')(''')
-
private void yourTreeView\_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { ((TreeView)sender).SelectedNode = ((TreeView)sender).GetNodeAt(e.Location); }
We will either find a way, or make one! (\ /) (- .-) C(''')(''')
Thanks a lot...
-
Thanks a lot...