C# WinForms: Alternating between ContextMenuStrips
Posted on 2012-09-20
I have defined three ContextMenuStrips, one for each of three node types. But I use all three node types in each of three TreeViews. So I think I need to programatically switch the ContextMenuStrip upon a right mouse click, then allow the context menu to open normally.
Am I seeing this right?
If so, I would need to:
1. Create my own class which inherits from TreeView
2. Override this event:
protected override void OnNodeMouseClick(TreeNodeMouseClickEventArgs e)
3. Find if it's a right mouse click?? (how do I do this since the event I am given is TreeNodeMouseClickEventArgs)
4. Set the ContextMenuStrip property of the TreeView
5. What next?
I am pretty sure if I did this, the context menu would not open.
Can I open it manually?