Private Sub CurrentPlaylist_ItemDrag(ByVal sender As System.Object, ByVal e As ItemDragEventArgs) Handles CurrentPlaylist.ItemDrag
DoDragDrop(e.Item, DragDropEffects.Move)
End Sub
Private Sub CurrentPlaylist_DragOver(ByVal sender As Object, ByVal e As DragEventArgs) Handles CurrentPlaylist.DragOver
Dim Item As ListViewItem
For Each Item In CurrentPlaylist.Items
Item.BackColor = System.Drawing.SystemColors.Window
Item.ForeColor = System.Drawing.SystemColors.WindowText
Next
If e.Data.GetDataPresent(GetType(ListViewItem)) = True Then
e.Effect = DragDropEffects.Move
Dim MouseLoc = CurrentPlaylist.PointToClient(New Point(e.X, e.Y))
Dim HighlightItem As ListViewItem = CurrentPlaylist.GetItemAt(Convert.ToInt16(MouseLoc.X), Convert.ToInt16(MouseLoc.Y))
If HighlightItem Is Nothing Then
Else
HighlightItem.BackColor = System.Drawing.SystemColors.Highlight
HighlightItem.ForeColor = System.Drawing.SystemColors.Window
End If
End If
End Sub
Private Sub CurrentPlaylist_DragDrop(ByVal sender As Object, ByVal e As DragEventArgs) Handles CurrentPlaylist.DragDrop
Dim DroppedItem As ListViewItem = e.Data.GetData(GetType(ListViewItem))
Dim MouseLoc = CurrentPlaylist.PointToClient(New Point(e.X, e.Y))
Dim DroppedOnItem As ListViewItem = CurrentPlaylist.GetItemAt(Convert.ToInt16(MouseLoc.X), Convert.ToInt16(MouseLoc.Y))
If DroppedOnItem Is Nothing Then
CurrentPlaylist.Items.Remove(DroppedItem)
CurrentPlaylist.Items.Add(DroppedItem)
Else
CurrentPlaylist.Items.Insert(DroppedOnItem.Index, DroppedItem.Text)
CurrentPlaylist.Items.Remove(DroppedItem)
End If
Dim Item As ListViewItem
For Each Item In CurrentPlaylist.Items
Item.BackColor = System.Drawing.SystemColors.Window
Item.ForeColor = System.Drawing.SystemColors.WindowText
Next
End Sub