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.
ADAdministrator Syncfusion Team August 25, 2004 08:21 AM
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));
DLDoug LindAugust 25, 2004 02:05 PM
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?
ADAdministrator Syncfusion Team August 25, 2004 02:15 PM
Here is a forum thread that shows a minimal sample to drawing feedback as you drag. Maybe that will give you some ideas.
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