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
close icon

Getting a cell''s boundaries (rectangle)

Hi, I am using OLE D&D to implement row dragging within a GDBG and would like to emulate the drop target indicator, used on a default row/column drag. My intent is to draw the drop target indicator from the MouseMove event. Is there a way to get a cells boundaries, relative to the grid? Are there any hooks in the cell model I can use? I''ve tried the example referred to in the Windows FAQ but the point at which the event triggers varies with mouse speed so I end up with drop targets in the middle of a cell. Thanks, Doug

3 Replies

AD Administrator Syncfusion Team August 25, 2004 12:21 PM UTC

If you are in the grid''s mousedown event, I think you can use code like this to get the cell rectangle.
int row, col;
Point pt = new Point(e.X, e.Y);
if(this.gridDataBoundGrid1.PointToRowCol(pt, out row, out col, -1))
{
	Rectangle cellRect = this.gridDataBoundGrid1.RangeInfoToRectangle(GridRangeInfo.Cell(row, col));
}


DL Doug Lind August 25, 2004 06:05 PM UTC

Thanks that worked great! Now that I can paint a line on the cell, how do I remove it. It seems like a refresh, refreshRange or invalidate would work but it does not occur. It may be that I am firing the refresh event from within a mousemove event, with a mouse button down (i.e. dragging). The code executes the call but nothing happens until the button is released. Is there a way to force the cell to repaint itself? Would being in drag mode have anything to do with it? Doug


AD Administrator Syncfusion Team August 25, 2004 06:15 PM UTC

Here is a forum thread that shows a minimal sample to drawing feedback as you drag. Maybe that will give you some ideas. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=10611 Here is another forum thread that has a sample using a DragHelper class in our library code. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=3815

Loader.
Live Chat Icon For mobile
Up arrow icon