C# 将ListView拖放到ListView(Listbox)

C# 将ListView拖放到ListView(Listbox),c#,winforms,listbox,drag-and-drop,C#,Winforms,Listbox,Drag And Drop,我正在用c#写一个小音频播放器 现在我想将一些项目从我的音乐库(ListView)拖放到播放列表(ListView或Listbox) 这样行吗 我正在使用Windows窗体,解决此问题的最佳方法是什么?是的,它会起作用。只需准备播放列表控件: ((Control)PlayList).AllowDrop = true; PlayList.DragEnter += PlayList_DragEnter; PlayList.DragDrop += PlayList_DragDrop; 并从库列表视图

我正在用c#写一个小音频播放器

现在我想将一些项目从我的音乐库(ListView)拖放到播放列表(ListView或Listbox)

这样行吗


我正在使用Windows窗体,解决此问题的最佳方法是什么?

是的,它会起作用。只需准备播放列表控件:

((Control)PlayList).AllowDrop = true;
PlayList.DragEnter += PlayList_DragEnter;
PlayList.DragDrop += PlayList_DragDrop;
并从库列表视图中启动拖动:

DoDragDrop( new DataObject( DataFormats.FileDrop, paths ), DragDropEffects.Link );
(只需根据需要修改参数)