Click here to Skip to main content
14,300,692 members
Rate this:
Please Sign up or sign in to vote.
See more:
Already I have created a windows Form with fix size of 725,567. and there i kept
much more buttons,pictureboxes,Gridviews,labels,checkbobes and etc....!
and there is no need to Maximize size Button on the Form!
Now the Client requirement is that, he just want Resize the form
at runtime by click with draging the right corner of the form where i marked the red strips!
and when he will do that,
the containts of the form would be automatically set on the basis of form size!
so please Everybody give me a perfect solution on this requirement!
johannesnestler 27-Jan-12 5:42am
If you didn't design it for resize in the fist place (allways a bad decision as you can see now, because this behaviour is so common today), you have to go through Dock and Anchor Logic (Don't try with Scale() function...). But this is nothing bad to learn for Windows Forms - and in the future use it from the beginning. But of course it can be a big pain now (depends on your code). Of course there is another solution: You can override Form's OnResize and do your own layout calculations (setting Size and Location properties of your child controls). In my life I have done both very often - one of the reasons why I like WPF now with it's (near) perfect scaling layouting...
Dnyanesh Wahiley 27-Jan-12 5:53am
Yes sir definatly its big pain for me right now! and Thank you for your suggestion i 'll keep mind these things!
Rate this:
Please Sign up or sign in to vote.

Solution 2

I believe this is a respost of the question you asked before on January 12:

And, that the answers given to that question can also answer this one.

And, nothing stops you at design-time in WinForms from selecting (use control-click, or click-drag, or whatever) more than one of any type of Control, and setting their Anchor or Dock properties at the same time: try it !

But, what are the "red strips" you refer to at the right-bottom of the Form ? Standard practice, in WinForms, is to enable the SizeGripStyle property of the Form, which will appear at bottom-right: you can force it to always appear by setting it to 'Show.
Amir Mahfoozi 30-Jan-12 1:36am
Rate this:
Please Sign up or sign in to vote.

Solution 1

You can satisfy your customers by setting "Dock" and "Anchor" Property of Control.
Read more about these properties on the net.
Dnyanesh Wahiley 27-Jan-12 5:43am
yes u r right but in that case i have to set the every controls Dock,Anchor property! and already i have mentioned in Question there are much more controls! so how!

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

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