title: How to Drag, Drop and Resize Label on a Panel at runtime? C#, winForms
body: <p>I have this code for dragging on a Panel but its not doing the thing.
  I have to choose if I will just Drag&amp;drop or Resize. 
  I think theres something wrong with my code here in form load.
  Anyway I have 5 labels here and a panel named as label1, label2, label3, label4, label5 on panel1.</p>
  
  <pre><code>    private void form_Load(object sender, EventArgs e)
      {
              //for drag and drop           
              //this.panel1.AllowDrop = true; // or Allow drop in the panel.
              foreach (Control c in this.panel1.Controls)
              {
                  c.MouseDown += new MouseEventHandler(c_MouseDown);
              }
              this.panel1.DragOver += new DragEventHandler(panel1_DragOver);
              this.panel1.DragDrop += new DragEventHandler(panel1_DragDrop);  
  
              //end of drag and drop
      }
  
      void c_MouseDown(object sender, MouseEventArgs e)
      {
          Control c = sender as Control;                       
              c.DoDragDrop(c, DragDropEffects.Move);
      }
  
      void panel1_DragDrop(object sender, DragEventArgs e)
      {
  
          Control c = e.Data.GetData(e.Data.GetFormats()[0]) as Control;
          lblResizeAmtWord.Visible = false;
          if (c != null)
          {
              c.Location = this.panel1.PointToClient(new Point(e.X, e.Y));
              //this.panel1.Controls.Add(c); //disable if already on the panel
          }
      }
  
      void panel1_DragOver(object sender, DragEventArgs e)
      {
          e.Effect = DragDropEffects.Move;
      }  
  </code></pre>