I will provide you the programming stuff which will help you to understand how the drag and drop of Images performs for PictureBox.
Code:
public partial class Form1: Form
(
public Form1 ()
(
InitializeComponent (); //here we will initialize the content of form
)
private void pictureBox1_MouseMove (object sender, MouseEventArgs e)
(
if (Button == e. MouseButton. Left) //clicking the mouse left button event
pictureBox1. DoDragDrop (pictureBox1. Image, DragDropEffects. All);
)
private void Form1_Load (object sender, EventArgs e)
(
pictureBox2. AllowDrop = true;
)
private void pictureBox2_DragEnter (object sender, DragEventArgs e)
(
if (e. Data. GetDataPresent (DataFormats. Bitmap))
e. Effect = DragDropEffects. Copy;
else
e. Effect = DragDropEffects. None;
)
private void pictureBox2_DragDrop (object sender, DragEventArgs e)
(
if ((e. Data. GetDataPresent (DataFormats. Bitmap)))
this. pictureBox2. Picture = (Bitmap) (e. Data. GetData (DataFormats. Bitmap));
)
)
This is an excellent example of what have been asked, and the above code is pretty well described and it is continuous flow.
Bookmarks