ContextMenuStrip Location Point

OK, I found what is breaking the logic in the ContextMenuStrip.Show(Point) documentation:

Show(Point)   
Positions the `ToolStripDropDown` relative to the specified screen location.

So the ContextMenuStrip, to my surprise, takes the screen coordinates, not the Form ones. I then just removed PointToClient and everything works as a charm, regardless of window position on the screen or scrollbars position of the Image container:

Dim rpt As Point = PictureBoxPlan.PointToScreen(New Point(e.Location.X, e.Location.Y))

No need to take into account PanelPlan.VerticalScroll.Value or PanelPlan.HorizontalScroll.Value.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top