Private Sub DvQurey_MouseMove(ByVal sender As System.Object,ByVal e As System.Windows.Forms.MouseEventArgs) Handles DvQurey.MouseMove
If (e.Button And Windows.Forms.MouseButtons.Left) = Windows.Forms.MouseButtons.Left Then
Dim hitTest As DataGridView.HitTestInfo = Me.DvQurey.HitTest(e.X,e.Y)
If hitTest.Type = DataGridViewHitTestType.Cell Then
If Me.DvQurey.SelectedRows.Count > 0 Then
dragData = New DragDataObject(eDragType.MoveLotSelected,Me.DvQurey.SelectedRows)
Me.DvQurey.DoDragDrop(dragData,DragDropEffects.Copy)
End If
End If
End If
End Sub
Private Sub DvSelected_DragEnter(ByVal sender As Object,ByVal e As System.Windows.Forms.DragEventArgs) Handles DvSelected.DragEnter
If e.Data.GetDataPresent(GetType(DragDataObject)) Then
Dim drg As DragDataObject = e.Data.GetData(GetType(DragDataObject))
If drg.DragType = eDragType.MoveLotSelected Then
e.Effect = DragDropEffects.Copy
End If
End If
End Sub
Private Sub DvSelected_DragDrop(ByVal sender As Object,ByVal e As System.Windows.Forms.DragEventArgs) Handles DvSelected.DragDrop
If e.Data.GetDataPresent(GetType(DragDataObject)) Then
Dim drg As DragDataObject = e.Data.GetData(GetType(DragDataObject))
Dim nRow As DataGridViewRow
Dim dRow As DataGridViewSelectedRowCollection
If drg.DragType = eDragType.MoveLotSelected Then
If tblShow.Rows.Count > 0 Then
dRow = CType(drg.Data,DataGridViewSelectedRowCollection)
For Each nRow In dRow
Me.tblSelected.ImportRow(tblShow.Rows(nRow.Index))
Next
Me.tblSelected.AcceptChanges()
Me.DvSelected.AutoResizeColumns()
End If
End If
End If
End Sub
原文链接:https://www.f2er.com/vb/258484.html