By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,162 Members | 1,050 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,162 IT Pros & Developers. It's quick & easy.

drag panels from one tableLayoutPanel to another and when dragging I want to copy the

P: 1
I want to drag panels from one tableLayoutPanel to another and when dragging I want to copy the panels don’t moving them,
What it now does is moving the item. Instead I want them to be copied (from tableLayoutPanel1 to tableLayoutPanel2), leaving the item in tableLayoutPanel1.
Can I do this? If you can give me an idea it will be great.Thank you

here's my code

Expand|Select|Wrap|Line Numbers
  1. public Form1()
  2.         {
  3.             InitializeComponent();
  4.             panel1.AllowDrop = true;
  5.             panel2.AllowDrop = true;
  6.             panel3.AllowDrop = true;
  7.  
  8.             panel1.DragEnter += panel_DragEnter;
  9.             panel2.DragEnter += panel_DragEnter;
  10.  
  11.             panel1.DragDrop += panel_DragDrop;
  12.             panel2.DragDrop += panel_DragDrop;
  13.         }
  14.  
  15.         private void panel3_MouseDown(object sender, MouseEventArgs e)
  16.         {
  17.             DoDragDrop(panel3, DragDropEffects.Copy);
  18.         }
  19.         private void panel3_MouseMove(object sender, MouseEventArgs e)
  20.         {
  21.             DoDragDrop(panel3, DragDropEffects.Copy);
  22.         }
  23.         private void panel_DragEnter(object sender, DragEventArgs e)
  24.         {
  25.  
  26.             e.Effect = DragDropEffects.Copy;
  27.         }
  28.         private void panel_DragDrop(object sender, DragEventArgs e)
  29.         {
  30.             ((Panel)e.Data.GetData(typeof(Panel))).Parent = (Panel)sender;
  31.         }
Nov 12 '13 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.