从listBox1拖动项到listBox2中private void listBox1_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Left && listBox1.SelectedItem!= null)
            {
                listBox1.DoDragDrop(listBox1.SelectedItem,DragDropEffects.Copy);            
            }
        }
private void listBox2_DragEnter(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(DataFormats.Text))
            {
                e.Effect = DragDropEffects.Copy;
            }
        }
private void listBox2_DragDrop(object sender, DragEventArgs e)
        {
            listBox2.Items.Add(e.Data.GetData(DataFormats.Text));
        }我指定了拖放效果为Copy,为什么不是移动, 还是复制呢?

解决方案 »

  1.   

    None  放置目标不接受该数据
    Copy  将拖动源中的数据复制到放置目标
    Move  将拖动源的数据移动到放置目标
    Link  将拖动源中的数据链接到放置目标
    Scroll  拖动时可以滚动目标,以定位在目标中当前不可见的某个放置位置
    All  Copy、Move 和 Scroll 效果的组合
      

  2.   

    Copy就是复制。。
    移动是Move
      

  3.   

    你可以试着把listBox2拉大一些,然后在将listBox1拉过去,不要按住ctrl。