protected override void EnhancedListBox_DragDrop(object sender, DragEventArgs e) { //external drag drop //in future use tracklist clipboard so it doesn't interfer //with copy/paste functions if (!InternalClipboard.IsEmpty) { manager.ClearSelection(); SelectedIndices.Clear(); PasteFrom(InternalClipboard.Files.ToArray()); InternalClipboard.Clear(); Focus(); Refresh(); return; } else { string[] data = WinFormUtils.GetExternalDragDrop(e); if (data == null) { base.EnhancedListBox_DragDrop(sender, e); InternalClipboard.Clear(); } else { PasteFrom(data); InternalClipboard.Clear(); this.Focus(); this.Refresh(); return; } } }
public static void CopyItems(List <ListViewItem> items) { InternalClipboard.Clear(); Clipboard.Clear(); foreach (ListViewItem item in items) { InternalClipboard.Add(item.SubItems[1].Text); Clipboard.SetText(item.SubItems[1].Text); } }
protected override void EnhancedListBox_DragDrop(object sender, DragEventArgs e) { if (!InternalClipboard.IsEmpty) { Point cp = PointToClient(new Point(e.X, e.Y)); ListViewItem dragToItem = GetItemAt(cp.X, cp.Y); int dropindex = manager.ItemCount; if (dragToItem != null) { dropindex = dragToItem.Index; } manager.AddFiles(dropindex, InternalClipboard.Files.ToArray()); InternalClipboard.Files.Clear(); this.Focus(); return; } else { string[] data = WinFormUtils.GetExternalDragDrop(e); if (data == null) { base.EnhancedListBox_DragDrop(sender, e); InternalClipboard.Clear(); } else { foreach (string file in data) { Point cp = PointToClient(new Point(e.X, e.Y)); ListViewItem dragToItem = GetItemAt(cp.X, cp.Y); int dropindex = manager.ItemCount; if (dragToItem != null) { dropindex = dragToItem.Index; } VItem i = manager.InsertPlaylistAt(dropindex, file); if (i == null) { continue; } i.Selected = true; } InternalClipboard.Clear(); this.Focus(); this.Refresh(); return; } } }