我自己做了一个音乐的播放器,写了一个播放列表用ListView实现的。 我现在想实现将歌曲直接拖入ListView让它自动添加到播放列表中!
我现在已经讲AllowDrop的值设置为true了;接下来我还需要怎么做呢?
请大神们指点一下!!

解决方案 »

  1.   

     private void listBox1_DragDrop(object sender, DragEventArgs e)
            {
                if (e.Data.GetDataPresent(DataFormats.FileDrop, false))
                {
                    String[] files = (String[])e.Data.GetData(DataFormats.FileDrop); //h获取当前拖拽的文件名
                    
                }
            }        private void listBox1_DragEnter(object sender, DragEventArgs e)
            {
                //设置拖拽类型(这里是复制拖拽)
                e.Effect = DragDropEffects.Copy;
            }        private void listBox1_DragOver(object sender, DragEventArgs e)
            {
                e.Effect = DragDropEffects.Copy;
            }