title: How to Drag & Drop PictureBox From One Windows Form To Another
body: <p>I am building a simple drag and drop game using windows forms. Its like a jigsaw puzzle. I want to drag pictures from one form to another to complete the puzzle. Is there a way to do this with a PictureBox. It seems to be the only property without the AllowDrop function. Source code below.</p>
  
  <p><a href="https://i.stack.imgur.com/60rr1.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/60rr1.jpg" alt="enter image description here"></a></p>
  
  <p>I want to drag images from the form on the left to the form on the right.</p>
  
  <p>I was following this tutorial but I cannot get my head around it.
  <a href="https://stackoverflow.com/questions/16004682/c-sharp-drag-and-drop-from-one-picture-box-into-another">C# Drag and Drop from one Picture box into Another</a></p>
  
  <p><strong>Form Right</strong></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Windows.Forms;
  
  namespace DragDropGame
  {
      public partial class ChildFormTwo : Form
      {
          public ChildFormTwo()
          {
              InitializeComponent();
  
              pictureBox3.DragEnter += pictureBox3_DragEnter;
              pictureBox3.DragDrop += pictureBox3_DragDrop;
          }
  
          private void pictureBox3_DragDrop(object sender, DragEventArgs e)
          {
              var bmp = (Bitmap)e.Data.GetData(DataFormats.Bitmap);
              pictureBox2.Image = bmp;
          }
  
          private void pictureBox3_DragEnter(object sender, DragEventArgs e)
          {
              if (e.Data.GetDataPresent(DataFormats.Bitmap))
                  e.Effect = DragDropEffects.Move;
          }
      }
  }
  </code></pre>
  
  <p><strong>Form Left</strong></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Windows.Forms;
  
  namespace DragDropGame
  {
      public partial class ChildFormTwo : Form
      {
          public ChildFormTwo()
          {
              InitializeComponent();
  
              pictureBox3.DragEnter += pictureBox3_DragEnter;
              pictureBox3.DragDrop += pictureBox3_DragDrop;
          }
  
          private void pictureBox3_DragDrop(object sender, DragEventArgs e)
          {
              var bmp = (Bitmap)e.Data.GetData(DataFormats.Bitmap);
              pictureBox2.Image = bmp;
          }
  
          private void pictureBox3_DragEnter(object sender, DragEventArgs e)
          {
              if (e.Data.GetDataPresent(DataFormats.Bitmap))
                  e.Effect = DragDropEffects.Move;
          }
      }
  }
  </code></pre>