Private Sub lbAll_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lbAll.MouseDown
'If lbAll.Items.Count = 0 Then
' Return
'End If
'Dim s As String = lbAll.Items(lbAll.IndexFromPoint(e.X, e.Y)).ToString()
'Dim dde1 As DragDropEffects = DoDragDrop(s, DragDropEffects.All)
'If dde1 = DragDropEffects.All Then
' 'lbAll.Items.RemoveAt(lbAll.IndexFromPoint(e.X, e.Y))
'End If
lbAll.DoDragDrop(lbAll.SelectedItems, DragDropEffects.Move)
End Sub
Private Sub lbSelected_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lbSelected.DragDrop
'If e.Data.GetDataPresent(DataFormats.StringFormat) Then
' Dim str As String = DirectCast(e.Data.GetData(DataFormats.StringFormat), String)
' lbSelected.Items.Add(str)
'End If
For Each item As Object In (e.Data.GetData(GetType(ListBox.SelectedObjectCollection)))
lbSelected.Items.Add(item)
Next
End Sub
Private Sub lbSelected_DragOver(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lbSelected.DragOver
' e.Effect = DragDropEffects.All
If (e.Data.GetDataPresent(GetType(ListBox.SelectedObjectCollection))) Then
e.Effect = DragDropEffects.Move
Else
e.Effect = DragDropEffects.None
End If
End Sub
No comments:
Post a Comment