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
120
Select a UltraTreeNode with Right Click of mouse
posted

 I'm trying to show a ContextMenuStrip assosiated with a WinTree but I need when MenuStrip shows, UltraTreeNode had been Selected Inmediately

cause I have to left Click before and then right click.

I was reading a similar post, and I use the code there supports but it didn't work.

 

thanks for your help 

  • 69832
    Offline posted

    this.ultraTree1.MouseDown += new MouseEventHandler(ultraTree1_MouseDown); 

    private void ultraTree1_MouseDown(object sender, MouseEventArgs e)
    {
        if ( e.Button == MouseButtons.Right )
        {
            UltraTree treeControl = sender as UltraTree;
            UltraTreeNode nodeAtPoint = treeControl.GetNodeFromPoint( e.Location );

            if ( nodeAtPoint != null )
            {
                nodeAtPoint.Selected = true;
            }
        }
    }