Your drag and drop capability is very nice. I can go from one grid to another or within a grid. Is there a property or method for dropping a row in the middle of a grid without overwriting an existing row?
ADAdministrator Syncfusion Team October 14, 2003 04:38 PM
No, but you can catch the DragDrop event and insert a row at that point to catch the dropped row.
private void gridControl1_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
Point pt = this.gridControl1.PointToClient(Control.MousePosition);
int row, col;
this.gridControl1.PointToRowCol(pt, out row, out col, -1);
PMPaul MullerOctober 15, 2003 11:11 AM
Unless I converted your code to VB improperly, there seems to be a bug. When I have a grid with 5 rows and I try to drag row 4 to tow 1, the result is 4, 1, 2, blank, 4, 5 instead of 4, 1, 2, 3, 5. Row 3 has disappeared! Here is my code:
Private Sub GridControl2_DragDrop1(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles GridControl2.DragDrop
Dim pt As New Point
pt = Me.GridControl2.PointToClient(Control.MousePosition)
Dim row, col As Integer
Me.GridControl2.PointToRowCol(pt, row, col)
If Len(Me.GridControl2(row, 1).CellValue) > 0 Then
ADAdministrator Syncfusion Team October 15, 2003 01:23 PM
When you drag a higher numbered row to a lower numbered row in the same grid, then inserting the new row for the dropped effectively increases the source row number by 1. This means that when the OLE code goes onto clear the source row, it clears the row immediately preceding the source row. The OLE D&D code has no knowledge that you have inserted a row above the source row.
So, if you need this functionality, you will have to work around this problem. Attached is one try at this. It uses the Clearing cells event to try to clear the proper row. It assumes you are only dragging 1 row. If you want to support dragging multiple rows, then you would have to extend this code to handle that.