Hello,
I`m using ultratree and if I call context menu by context menu button it opens in реу center of the control.
But I need it to be opened beside the active or selected node.
Any suggestions?
Assuming you are using the System.Windows.Forms.ContextMenu, there is an overload to the Show method that takes the coordinates at which to display the menu.
In order to get the client coordinates of the node at the cursor position, you could do something like this in the MouseDown event handler:
void ultraTree_MouseDown(object sender, MouseEventArgs e){ UltraTree control = sender as UltraTree; UltraTreeNode nodeAtPoint = control.GetNodeFromPoint( e.Location );}
Thanx for quick reply,
But I`m talking about http://en.wikipedia.org/wiki/Menu_key button and could you, please, suggest how to handle that event.
Yes, I`m using class derived from ContextMenu but I can`t override Show method cause it is not virtual.
I'm not sure I'm following this but I didn't say to override the Show method, I said there is an overload that takes client coordinates.
Now it would seem the way it is getting shown is by the user pressing the menu key. I don't think you can intervene in that process, although you might be able to redefine the Show method and force it to always show near the ActiveNode. This solution implies that this ContextMenu would onyl be used for this purpose.