Click here to Skip to main content
11,637,176 members (61,995 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
Hi

I want to change windows control size on every main form size change. Suppose if form maximize the inner control size increase and when it restore then inner control size is decrease. For this i am using anchor property of inner control but the actual size increase slowly and not decrease it.
Posted 17-Jan-13 22:15pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You will have to use both anchoring and docking here. Depending upon the number of controls and which ones should resize or not, you can decide anchoring and docking for the controls.

I personally use TableLayoutPanel control with row and columns sizes set by percentage. Each cell with then have one control in it with Docking set to All. TableLayoutPanel itself will have Docking set to All.

This means that now cells will grow and shrink with the form. As the controls are placed in the cell, they too will grow and shrink.

For the controls that should remain same size, their column and row size must be set to absolute value.

This is quite useful in a form with lots of controls.

Take a look at this. You can also test things at design time itself.
  Permalink  
Comments
Dharmendra-18 at 18-Jan-13 4:47am
   
I can not use the table layout panel.
d@nish at 18-Jan-13 4:59am
   
Why?
Dharmendra-18 at 18-Jan-13 5:11am
   
because application is completed with coding
d@nish at 18-Jan-13 5:15am
   
So can't change code? If yes, you cannot do anything. TableLayoutPanel should not affect anything unless there Control.Parent property was used anywhere or if Control.Controls collection was used.

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

  Print Answers RSS
0 OriginalGriff 295
1 stibee 288
2 jyo.net 270
3 Sergey Alexandrovich Kryukov 214
4 himanshu agarwal 184
0 OriginalGriff 9,031
1 Sergey Alexandrovich Kryukov 8,513
2 Mika Wendelius 6,922
3 F-ES Sitecore 2,388
4 Suvendu Shekhar Giri 2,320


Advertise | Privacy | Mobile
Web01 | 2.8.150728.1 | Last Updated 18 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100