Quote:Using HitTest but the type is always none
Private Sub DataGridView1_DragDrop(sender As Object, e As DragEventArgs) Handles DataGridView1.DragDrop Dim C, R as integer ... Dim myDGV As DataGridView = sender Dim HtInfo As DataGridView.HitTestInfo = myDGV.HitTest(e.X, e.Y) If HtInfo.Type = DataGridViewHitTestType.Cell Then C = HtInfo.ColumnIndex R = HtInfo.RowIndex DropColNo = C : DropRowNo = R lblDebug.Text &= " Hit=" & C & "," & R & " " myUseCol = C : myUseRow = R 'DataGridView1.CurrentCell = DataGridView1(C, R) Debug.WriteLine("Drag Drop Current HIT Cell " & C & "," & R) GoTo DoPic Else C = HtInfo.ColumnIndex : R = HtInfo.RowIndex Debug.WriteLine("Drag Drop Current Bad HT=" & C & "," & R) lblDebug.Text &= " Invalid type " & HtInfo.Type.ToString() If DropColNo > -1 AndAlso DropRowNo > -1 Then myUseCol = DropColNo : myUseRow = DropRowNo 'DataGridView1.CurrentCell = DataGridView1(DropColNo, DropRowNo) Debug.WriteLine("Drag Drop bad Hit Cell " & DropColNo & "," & DropRowNo & " " & HtInfo.Type.ToString()) Else lblDebug.Text &= " invalid drop=" & DropColNo & "," & DropRowNo & " " Debug.WriteLine("Drag Drop bad dropCol/Row invalid drop=" & DropColNo & "," & DropRowNo & " ") End If End If ... End Sub
CellMouseDown
DragEnter
DragDrop
Point p = dataGridView2.PointToClient(new Point(e.X, e.Y); DataGridView.HitTestInfo info = dataGridView2.HitTest(p.X, p.Y);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)