Reputation: 1869
I have a datagridview and need of context menu. When i right-click on cell (RED POINT) - context menu shows.. But in wrong place. Can't understand why here is the code:
ContextMenu m = new ContextMenu();
m.Show(ServersTable, new Point(Cursor.Position.X, Cursor.Position.Y));
That stuff really annoys me!
Upvotes: 3
Views: 1205
Reputation: 67898
Just translate the point to the grid:
m.Show(ServersTable, ServersTable.PointToClient(
new Point(Cursor.Position.X, Cursor.Position.Y)));
Upvotes: 5