Click here to Skip to main content
15,905,781 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi friends..
how to increase the size of each and every cotrol in the form when the form size increases. and one more thing the controls should not merge each other.. Anchor Property is not working fine.


I have Labels, TextBoxes, Buttons in the form... when resizing the form the labels, textboxes and the buttons size will be increase and the allignment should be proper and should be placed in the center on the form... please send me one sample application.

thanks in advance...
Posted
Updated 5-May-11 19:26pm
v3

You're right, better don't use anchor. At the same time, it's not good too change the size of every control. You can try (just respond to resize event), but it can be ugly. One reason: change in size will change aspect ratio. It's much better to use the schema based on Dock and using, in particular, System.Windows.Forms.DockStyle.Fill style. Only the controls of this style will change the size and shape.

Please see my past advices of size-tolerant design:
Zom Out malfunctions when Screen resolution changes[^];
see also:
GUI Apperance - C#.Net[^].

—SA
 
Share this answer
 
Comments
Harish Reddy K 6-May-11 1:21am    
thankq..

Can u send me the code...
Sergey Alexandrovich Kryukov 6-May-11 1:29am    
Code of what?!!
--SA
Harish Reddy K 6-May-11 2:57am    
a sample project related to increasing size of the controls when form resizes
thankq once again...

Harish..
Sergey Alexandrovich Kryukov 6-May-11 3:08am    
There are too many aspects. But there is no code in such approach, just a layout. From the other hand, sample codes and showing all techniques would take an article...
--SA
SKOTAJI 6-May-11 2:01am    
Use Table Layout panel with docking style. Much better !
Hope you are using C# winforms. Use table layout pane with double buffered nature to the control. Here, divide the cell / rows / columns as you need ! Place a control there with Dock style FIll ..

You can feel it as HTML Table 100% hieght / width adjustments. Every thing is possible with Table layout panel.

Enjoy the C# given facilities ! Any comments ?
 
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