eYe
eYe

Reputation: 1733

How to find coordinates of a point inside selected row in DataGridView

I know that DataGridView.HitTest can be used to find an index of a row at a specific point, but how can I find the coordinates of a point somewhere inside a SelectedRow of a DataGridView?

Clarification: I need coordinates of a point inside SelectedRow without mouse click action. The row selection occurs programatically.

Upvotes: 1

Views: 628

Answers (1)

bokibeg
bokibeg

Reputation: 2142

var rt = dgv.GetRowDisplayRectangle(rowIndex, false);

From MSDN:

public Rectangle GetRowDisplayRectangle( int rowIndex, bool cutOverflow )

It will give you exact coordinates of any given row relative to the grid's coordinates.

Upvotes: 2

Related Questions