Click here to Skip to main content
15,949,741 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hello
I am developing an application in C# .NET. The forms in the application are re-sizable by the end user, like all standard applications. I need the controls like pictureboxes, textboxes and labels on the forms to be re-sized and repositioned according to the change in forms size. I've tried anchor and dock properties but couldn't get them work exactly how I wanted to. Any help please..
Posted
Comments
Sergey Alexandrovich Kryukov 3-Aug-13 23:35pm    
Use Dock with Padding, use the hierarchy of controls (many of then would be Panels) to get desired result. Keep trying.
—SA

1 solution

Have you tried setting the Dock property of the Control to Fill as:

C#
YourControl.Dock = DockStyle.Fill;


using this your control will auto fill to the size of whole form
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 3-Aug-13 23:34pm    
Good answer: that's the best way. Also, it's important to use the property System.Windows.Forms.Controls.Padding on a parent control.
—SA

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