0

I would like to have a context menu pop up, if I perform a right click somewhere on my TreeView (not the individual nodes).

This kinda works but the menu pops up way off the click position. I tried it with this trick HERE but it doesn't work.

Here is my code and a scrrenshot. Any ideas ?

    private void Mainform_TreeView_MouseDown(object sender, MouseEventArgs e)
    {
        contextMenuStrip1.Show(PointToClient(Cursor.Position));
    }

enter image description here

Community
  • 1
  • 1
B. Ueno
  • 159
  • 2
  • 13

1 Answers1

0

Ah...the overload that accepts only a Point expects Screen Coords, so you simply need:

contextMenuStrip1.Show(Cursor.Position);
Idle_Mind
  • 38,363
  • 3
  • 29
  • 40