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.

MouseDown event and absolute column/row

Thread ID:

Created:

Updated:

Platform:

Replies:

8575 Nov 12,2003 10:56 AM Nov 12,2003 12:53 PM Windows Forms 1
loading
Tags: GridControl
Eric Demers
Asked On November 12, 2003 10:56 AM

Hi, I'm trying to figure out how to get the absolute Row/Column in the Grid.MouseDown event. I can get the visible Row/Column, but I NEED the absolute Row/Column. Is there a way to get this information without going into the CellMouseDown event? The problem I have with using the CellMouseDownEvent, is that I do not want the user to actually get into the cell, but it's too late at that time, as the cell is being changed to the Edit mode. Maybe I'm not using the right events to deal with that issue! Please help!

Administrator [Syncfusion]
Replied On November 12, 2003 12:53 PM

You can get the row and col with code like this.
private void gridControl1_MouseDown(object sender, MouseEventArgs e)
{
	int row, col;
	if(this.gridControl1.PointToRowCol(new Point(e.X, e.Y), out row, out col, -1))
	{
		Console.WriteLine(row.ToString() + "  " + col.ToString())
	}
}
But if you want to prevent the currentcell from moving with a click, you might try setting e.Cancel = true in CurrentCellMoving.
private void gridControl1_CurrentCellMoving(object sender, 
	GridCurrentCellMovingEventArgs e)
{
	if(e.ColIndex == 3)
		e.Cancel = true;
}

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.

;