private void label1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { if (System.Windows.Forms.Control.MouseButtons == System.Windows.Forms.MouseButtons.Left) { //start dragDrop operation, MyDropTarget will be called when the cursor enters the AutoCAD view area. AcadApp.DoDragDrop(this, "Drag & drop successful!!!", System.Windows.Forms.DragDropEffects.All, new MyDropTarget()); } }
private void PictureBox_MouseMove(object sender, MouseEventArgs e) { //获取发出移动操作的图片框对象 PictureBox pictureBox = sender as PictureBox; //只执行左键移动操作,以表示进行了拖放操作 if (System.Windows.Forms.Control.MouseButtons == MouseButtons.Left) { //图片框对象触发拖放事件,调用拖放操作事件处理函数,并传入图片框对象的Name属性供事件处理函数进行判断 AcadApp.DoDragDrop(this, pictureBox.Name, DragDropEffects.All, new MyDropTarget()); } }