We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

selecting a row from mouse position

Thread ID:

Created:

Updated:

Platform:

Replies:

69472 Oct 29,2007 02:26 PM Oct 29,2007 07:06 PM Windows Forms 1
loading
Tags: GridControl
mark
Asked On October 29, 2007 02:26 PM

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

haneefm [Syncfusion]
Replied On October 29, 2007 07:06 PM

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;