Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone,

I want to know how can I resize a winform in the designer so that it gives me the real size as when you maximize the form so that I know exactly where to put my form components.

Any idea how to do that?
Posted

How do you intend to get the "real size" for a maximized form? Different users will potentially be using different resolutions on their monitors, so a maximized form on each of their systems will differ.
I would suggest that you decide on a minimum size of your form based on the controls you want to have on the form and set up the sizing and such based on that. Then using a combination of docking and anchoring decide on rules for when the form is made larger by the user.
 
Share this answer
 
Comments
Mabchour 1989 1-Mar-12 15:16pm    
Actually the computer on which i'm programming is the one to be used to operate with the application.
Espen Harlinn 1-Mar-12 15:36pm    
5'ed!
Sergey Alexandrovich Kryukov 1-Mar-12 21:22pm    
It does not really matter. You should do the opposite -- create size/resolution tolerant design; please see the advice in my answer.
--SA
fjdiewornncalwe 1-Mar-12 17:45pm    
But what happens if you get a new monitor or computer with a different resolution. Then you have to refactor your application because of that. This is just plain bad programming style.
Sergey Alexandrovich Kryukov 1-Mar-12 21:21pm    
Basically, all correct, my 5. It looks like OP relies to Designer too much and have little to no idea on testing, forget the proper layout.

I added some advice on proper layout design in my answer, please see.
--SA
Nope. Your best recourse is to design your form with a minimum and/or maximum size in mind, and use docking and/or anchors in a manner appropriate to your intentions when the form is resized.

Once the form is designed, you can compile run the app and see what happens when you resize.

Of course, you can also simply not allow the form to be resized at all, but that may not be a viable option for you. Only you can answer that question.
 
Share this answer
 
Comments
Mabchour 1989 1-Mar-12 15:16pm    
Actually the computer on which i'm programming is the one to be used to operate with the application.
#realJSOP 1-Mar-12 16:04pm    
It doesn't matter - you cannot operate the control menu buttons inside the designer. You MUST compile the app and run it to see what's going to happen. If you know for a fact that the app is going to be used only on one computer, you can set the size of the form accordingly, but that's bad practice, even on a limited use application.
Espen Harlinn 1-Mar-12 15:36pm    
5'ed!
Sergey Alexandrovich Kryukov 1-Mar-12 21:15pm    
My 5. The problem looks like OP relies to Designer too much and have little to no idea on testing, forget the proper layout.
--SA
In addition to the answers by Marcus and John: you best bet it to learn form layout highly tolerant to the size of the window in principle, at least on maximum sizes. As to the minimal size, you better find out the best using the Designer. The key is in using many nested panels and other similar controls (like TabControl) and use docking with padding.

Please see my past answers on the size/resolution-tolerant design and related design issues:
Zom Out malfunctions when Screen resolution changes[^],
GUI Apperance - C#.Net[^];

rudimentary code sample here:
how to dock button so that it can adjust with the form[^].

—SA
 
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