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

Column Resizing and DoDragDrop

I am trying handle a drag out of a GridControl that has GridResizeCellsBehavior.InsideGrid set. I handle the MouseDown event and gather all of the drag information. I call DoDragDrop and the drag starts. This part works ok. The problem is that once I call DoDragDrop I cannot resize the columns by dragging the column edge in the grid. It becomes a data drag, not a column resize drag. How can I detect in the MouseDown event whether I am on the column edge or in the middle of the cell? Thanks

1 Reply

AD Administrator Syncfusion Team July 30, 2004 12:35 PM UTC

Here is one try at it that gets the cell rectangle, and shrinks it a little, and then tests whether the point is in the shrunken rect.
private void gridControl1_MouseDown(object sender, MouseEventArgs e)
{
	int row, col;
	Point pt = new Point(e.X, e.Y);
	if(this.gridControl1.PointToRowCol(pt, out row, out col, -1))
	{
		Rectangle rect = this.gridControl1.ViewLayout.RangeInfoToRectangle(GridRangeInfo.Cell(row, col),
			             true, GridCellSizeKind.ActualSize);
		rect.Inflate(-3, -3);
		if(rect.Contains(pt))
		{
			Console.WriteLine("Inside cell");
		}
	}
}

Loader.
Live Chat Icon For mobile
Up arrow icon