Click here to Skip to main content
16,017,238 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have two panels made dynamaically in the form Panel A and Panel B......


And Two buttons on to the form made dynamaically...Button A and Button B........


i have to drag and drop Button A to Panel A And Button B to Panel B...in Runtime..
How can i do that...
Posted
Updated 12-Dec-11 1:43am
v2

1 solution

You could create a generic handler for your drag and drop functionality. Then when your create the panels, you can add the DragDrop and DragOver events to your generic handler.

Within your handler simply use the Sender object, to work out the source of the event, and the e.Data.GetData to work out what data has been dragged.

Private void generic_DragDrop(object sender, DragEventArgs e)
{

Your code here

}

Private void generic_DragOver(object sender, DragEventArgs e)
{

Your code here

}

YourPanel.DragDrop += generic_DragDrop;
YourPanel.DragOver += generic_DragOver;

This should be enough of a pointer to get you going.

Derek
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900