Windows Develop Bookmark and Share   
 index > Windows Forms Designer > How to copy the panel including controls and paste in the same form?
 

How to copy the panel including controls and paste in the same form?


Hi all,

I have a panel with some textboxes and buttons in windows application. If I clik one of the button I need to create the same panel including the controls what the previous panel contains. if i click the any of the buttons that in the second panel it should be create the same panel with the same control including the events.

Is it possible to do that?

Thanks in advance.

Regards
R.eswaran.
sridaran77  Tuesday, July 15, 2008 2:04 PM

HI sridaran77

Addressing the problem, we can create a UserControl to wrap all the controls that should be requested to add. Because we want to click one button of the UserControl to create a new instance, we should exposed one event which should be triggered by the button’s click event.

Finally, we subscribe the event to handler method with which we add the new instance of the UserControl in the Container.

Note we should change the position every time when we add new instance, otherwise, we will only see the new instance only be added once for the others are overlapped.

Best Regards,

Bruce Zhou

Bruce.Zhou  Monday, July 21, 2008 10:11 AM

HI sridaran77

Addressing the problem, we can create a UserControl to wrap all the controls that should be requested to add. Because we want to click one button of the UserControl to create a new instance, we should exposed one event which should be triggered by the button’s click event.

Finally, we subscribe the event to handler method with which we add the new instance of the UserControl in the Container.

Note we should change the position every time when we add new instance, otherwise, we will only see the new instance only be added once for the others are overlapped.

Best Regards,

Bruce Zhou

Bruce.Zhou  Monday, July 21, 2008 10:11 AM

You can use google to search for other answers

Custom Search

More Threads

• Designer Crash: WPF User Control contains another WPF User Control
• Gradient Panel
• Splitter with dynamic redraw while dragging
• Adding References in the Design Time automatically
• Using TabControl
• Custom components incorrect position in 2005.
• Where are the "Standard Menu Icons" located?
• Multiple [Modifiers] property is added to each component in design time when rebuilding projectsâ€
• Ugh. Deleted an event handler, now Forms Designer is hosed. Lil help?
• datagridviewcheckboxcolumn question?