Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
2.00/5 (3 votes)
See more:
I many usercontrol created dynamically on a panel. Now I want to select usercontrol and implement cut, copy, paste feature..
so my problem is how to select a group of usercontrol In a perticular region.
Posted
Comments
Abhishek Sur 25-Sep-10 15:09pm    
I am unable to understand your problem. Cut-copy-paste should be implemented within the UserControl. Please make it a bit clear what you are looking for.
[no name] 25-Sep-10 15:44pm    
What technology are you using, Windows or Web? It makes a big difference in the answer.
himani_jha 25-Sep-10 18:25pm    
I have a panel on which there are many usercontrol of different type. when I click on panel and move clicked mouse then It draws a rectangle between mouse down position and mouse current position. After mouse up I want to know which user controls are get selected (means In that particular rectangle). so that I can perform operation on it like copy paste.
himani_jha 25-Sep-10 18:26pm    
I am using Windows form

After your comment:

Sorry, I misremembered. I should have said Intersect.

You have a rectangle that you have drawn. You can get the Bounds property of the controls in turn (search for 'c# iterate controls') to find out how, which is a rectangle. Then for each control use:

C#
if (Rectangle.Intersect(myDrawnRectangle, controlBoundsRectangle) != Rectangle.Empty)
{
   // part of the control is in your rectangle
   // do what you want with it.
}


Good luck! :)
 
Share this answer
 
Comments
himani_jha 27-Sep-10 2:44am    
Reason for my vote of 5
Automatic vote of 5 for accepting answer.
himani_jha 27-Sep-10 2:45am    
thanku very much...
If you are using Windows Forms, this[^] might give you a few ideas.
 
Share this answer
 
Comments
himani_jha 25-Sep-10 18:24pm    
thanks for ur reply. but I think my problem is different. It is windows form.

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