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. Image for the cookie policy date

Different drag cursors for row and column drags

Hi, Is it possible to change the grid cursors for the drag operation so that the column drag cursor is different from the row drag cursor? Thanks, Sue

1 Reply

AD Administrator Syncfusion Team August 3, 2004 04:46 PM

In general, the easiest way to change a grid cursor is to derive the grid and override OnSetCursor. In the override, explicitly set the Cursor.Current static varaible to the special cursor where ever you want it. For example, below is code that sets a cross cursor over cell 2,2.
public class MyGridControl : GridControl
{
	protected override void OnSetCursor(ref Message m)
	{
		base.OnSetCursor(ref m);
		Point pt = this.PointToClient(Control.MousePosition);
		int row, col;
		if(this.PointToRowCol(pt, out row, out col, -1)
			&& row == 2 && col == 2)
		{
			Cursor.Current = Cursors.Cross;
		}
	}
}
You can also do the by deriving GridDragSelectMouseController and overriding Cursor to provide the cursor that way. It would take a little more work than just deriving the grid.

Loader.
Live Chat Icon For mobile
Up arrow icon