Click here to Skip to main content
15,915,864 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi friends

i have one windows form in vs 2010. i want when i maximize the form my controls in that form will also maximize & automatically adjust in the form.
Posted
Comments
RDBurmon 8-Jun-12 8:29am    
Thanks Everyone who replied to this thread , So OP , I think you have got enough response and you should be able to mark it as your answer and close the thread.

It's not a good idea. The problem is that although it is easy to get controls to grow and shrink automatically with the form - it's just a case of setting the Dock and Anchor properties, or of using resizing panels - the control is the only thing that grows or shrinks. Any text for example does not, so you end up with a massive button with teeny tiny text in the middle, looking really silly. Design for a size, and allow your controls to move, but don't automatically re-size them all.

You can do it very easily in WPF, but there is a serious learning curve involved there.
 
Share this answer
 
Use the Anchor property to define how a control is automatically resized as its parent control is resized.

Anchoring a control to its parent control ensures that the anchored edges remain in the same position relative to the edges of the parent control when the parent control is resized.

Anchor Property in C#[^]
A CP article on: Working with Anchoring and Docking Properties[^]

Ref: Anchoring and Docking [^]
 
Share this answer
 
Hi
see

MP3 Rearrange

look at class FormPreview, method OnResize()

You will have to adapt the math to fit your controls.

Also, look at how I persist the form size, state and location.
 
Share this answer
 
Refer my answer for similar question: resize panel with window[^]
 
Share this answer
 
thanx guys, i set the anchor property of my controls to "none" then when i maximized the form all my controls are cum in the center of the form .
 
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