private void listBox1_MouseDown(object sender, MouseEventArgs e)
        {
            //调用DoDragDrop方法
            if (this.listBox1.SelectedItem != null)
            {
                this.listBox1.DoDragDrop(this.listBox1.SelectedItem, DragDropEffects.Copy);
            }
        }

 

            //设置treeview的AllowDrop属性(允许放置属性)为true
            this.treeView1.AllowDrop = true;

 

private void textBox1_DragEnter(object sender, DragEventArgs e)
        {
            //设置拖拽类型(这里是复制拖拽)
            e.Effect = DragDropEffects.Copy;
        }

        private void textBox1_DragDrop(object sender, DragEventArgs e)
        {
            //获取值
            TableInfo item2 = (TableInfo)e.Data.GetData(typeof(TableInfo));
            this.textBox1.AppendText("\n");
                this.textBox1.AppendText(item2.TableName);
//            MessageBox.Show(item2.TableName);
        }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-25
  • 2021-07-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-02
猜你喜欢
  • 2021-06-10
  • 2022-12-23
  • 2022-12-23
  • 2021-06-29
  • 2022-12-23
  • 2022-12-23
  • 2022-01-10
相关资源
相似解决方案