I have a ContextMenuStrip in which different options are shown depending on which cell of a DataGridView the user clicks on. My problem is that I am unable to get the x & y co-ordinates of cells.
I get the mouse position by using :
Point mouse = MousePosition;
I tried getting the cell's location by saying:
Rectangle cell = dataGridView.Rows[r].Cells[idx].ContentBounds;
cell.Offset(this.Left + dataGridView.Left, this.Top + dataGridView.Top);
However, the cell co-ordinates I get are completely wrong. Any ideas?
Thanks for the help in advance guys!