Trying to drag and drop image from one application to another...

Oct 20 2004 5:05 PM
I have two applications, each with a PictureBox. How do I drag and drop the picture as is from the PictureBox in one application to the PictureBox in the other application? I've tried this (didn't work): In source... private void pictureBoxSource_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { if (e.Button == MouseButtons.Left) { pictureBoxSource.DoDragDrop( pictureBox1.Image, DragDropEffects.Copy ); } } In target... private void pictureBoxTarget_DragEnter(object sender, System.Windows.Forms.DragEventArgs e) { if ( e.Data.GetDataPresent( DataFormats.Bitmap ) ) { e.Effect = DragDropEffects.Copy; } else e.Effect = DragDropEffects.None; } private void pictureBoxTarget_DragOver(object sender, System.Windows.Forms.DragEventArgs e { e.Effect=DragDropEffects.Copy; } private void pictureBoxTarget_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) { if ( (e.Data.GetDataPresent(DataFormats.Bitmap))) { this.pictureBoxTarget.Image = (Bitmap)(e.Data.GetData(DataFormats.Bitmap)); } }