selecting a row from mouse position

I'm trying to select a row based on the mouse position. How to I know which row the mouse pointer is on from a the mouse coordiantes in the MouseEventArgs?

Thanks

1 Reply

HA haneefm Syncfusion Team October 29, 2007 11:06 PM UTC

Hi Shariff,

You could determine the rowindex of the grid using the grid.PointToRowCol() method in the MouseDown event of the grid.

int row, col;
void gridControl1_MouseDown(object sender, MouseEventArgs e)
{
Point pt = new Point(e.X, e.Y);
this.gridControl1.PointToRowCol(pt, out row, out col);
Console.WriteLine("RowIndex: {0}", row);
this.gridControl1.Model.Selection.Add(GridRangeInfo.Row(row));
}

Best regards,
Haneef

Loader.
Up arrow icon