In winform datagrid, How to find the datagridcell by mouse coodina

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there,
I have a problem needs help.

In a winform, I have a datagrid.

In Mouse move event, I can get coodinates of Mouse. I want to decide which
datagridcell my mouse is on. Can anybody tell me how to do it?

Thanks,

Karl
 
Karl said:
In Mouse move event, I can get coodinates of Mouse. I want to decide
which datagridcell my mouse is on. Can anybody tell me how to do it?

private void datagrid_MouseHover(object sender, System.EventArgs e)
{
Point pt = this.PointToClient(Cursor.Position);
DataGrid.HitTestInfo myHitTest = datagrid.HitTest(pt);
int column = myHitTest.Column;
int row = myHitTest.Row;
// :
// :
 
Back
Top