Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
380
Context menu called by context menu button...
posted

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?

Parents
  • 69832
    Offline posted

    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 );
    }

Reply Children