autosize forms at different resolutions

Ultrawhack

Well-known member
Joined
Jul 5, 2006
Messages
164
Location
Canada
Programming Experience
3-5
Hi,

Maybe vb.net has an easy answer to this. How can I ensure that my form/controls all autoresize no matter what the end users screen resolutions ?

Thanks !
 
Why should the screen resolution affect the size of your form? If I set my screen resolution really high it's not because I want the forms to be bigger. That would defeat the purpose. I set a high resolution so I can fit more on the screen. If you make your form bigger on a higher resolution then you're violating the wishes of the user and that does not good software make.
 
I'm not sure if I was clear enough. So what you're saying is that once I design my form to near fullscreen on my 800x600 resolution and I distribute my app and my end user uses 1600x1200, it will autosize and appear in proportion ? Autosizing forms is an issue in Access (& VBA) programming.

How can I ensure that my forms appear proportionate no matter what end users screen resolution is. This doth make good software.
 
dude what John was trying to tell you is that you suppose to tend to make the app to looks exactly as on your screen ... and that if an user runs that app with 1600x1200 resolution it will look very odd. Why? Well, how do you like textBox control with width = 800 and it suppose to receive only couple letters/numbers like a price or something. How it would look like if your small image in the middle of the form stands there with an enormous big space around itsself?
I am afraid i cannot explain very well the idea (lack of english) but hope someone will do that for you.

Regards ;)
 
This is what we trying to explain to you ... with anchored controls your app will look just like on the 2nd picture bellow if user has higher screen resolution and that's why autosize is not always good idea. Althrough sometimes it is ... again it depends on GUI you have there.
 

Attachments

  • original.jpg
    original.jpg
    8.5 KB · Views: 73
  • streched.jpg
    streched.jpg
    13.7 KB · Views: 68
The issue with forms getting messed up on some screens is not one of resolution but DPI. I don't know all the details but I believe that pixels on some laptop screens aren't square, which can muck things up. You should research the AutoScaleMode property of the ContainerControl class. Again, I don't know all the details but that is the relevant property.
 
It seems i missunderstood John's statement but anyway i still claim that my advice is valid.
However, about your question:
Ultrawhack said:
Hi,
Maybe vb.net has an easy answer to this. How can I ensure that my form/controls all autoresize no matter what the end users screen resolutions ?
Thanks !

1st care to set the WindowState to maximised and also care to use appropriate Anchors for the controls as well as Dock property if you must.
That's how you will simply achieve autosize of your app.
Regards ;)
 
I'm with you Kulrom. I'm saying, just as you are, that if you design a form that is 640 x 480 pixels then that form should be 640 x 480 pixels regardless of the current resolution. I have a 24" wide-screen (mmm... Dell 2405. SLURP) that runs at 1920 x 1200. I have a screen that size because I want to fit lots of stuff on it. I don't want the apps I run to increase the size their windows to fill the space. Do you get bigger furniture if you get a bigger house? If the user increses the resolution of their screen it is to fit more on it. If you make your forms bigger you completely defeat that purpose. Obviously there are a lot of forms that can be resized. They are usually the ones with multiline text input areas that will grow and shrink with the form. You accomplish that by using the Anchor property as Kulrom suggested. There are a great many controls that you wouldn't want to have grow and shrink with the form. If all the controls on a form fall into that category then it is appropriate for the size of the form to be fixed.
 
Thanks guys. Lets say you have a multiline text area in your 640x480 designed form. When that form is viewed on your 24" wide-screen (mmm... Dell 2405. SLURP) that runs at 1920 x 1200,
do you find the text in that textbox legible... unless the form controls are set to grow and shrink with the form as it is resized?

So what you're saying is that in these legitimate cases the solution is to set the WindowState to maximised and to use appropriate Anchors for the controls as Kulrom suggested..

I hear you and I think you see my side of it...

Thanks !
 
Scaling forms at different resolutions

I made a form that looks roughly the way I want it to at 1200X800 resolution. However, if I display it at 800X600 resolution, it does not display correctly.

Anchoring the various controls on the form isn't really fitting the bill. I have been working on programattically (and tediously) setting the location, size, and font of every control on the form at Form_Load time based on the resolution at that time.

It is working and the form looks the same (albeit grainier) at 800X600, except is there an easier way?
 
Last edited:
What if I design the form to display at 2000X1600 and the end user tries to display it at 640X480? He might have controls running off the form if they're not anchored or stretching in physical size if they are anchored in all directions. Isn't there a way to make it so the guy with 640X480 can still display all of the information, except simply have it be grainier?
 
In addition to Anchor and Dock properties there is the container controls to help with layout, they are found in the Containers section of toolbox and there are three new ones in .Net 2.0 if you knew the framework before that (one of them is the SplitContainer that replaces the older Splitter control). Using containers is also helpful if Anchor and Dock really can't cope at some resolution, helping you to quickly move grouped controls with code by just relocation the container.
 
However, if I display it at 800X600 resolution, it does not display correctly.
I know there will be a lot objections about this but personaly i would never care about the user who run under 800x600.
Actually i beleive that there are very small number of people who still use 800x600. 1024x768 became sort of standard resolution.
It is almost same when you see the newer application which run only under Windows 2k and above ...means win95, win98 and nt users cannot use most of the newer applications. For instance below are Photoshop CS requirements:

Intel Pentium III or Pentium 4 processor
Microsoft Windows 2000 with Service Pack 3 or Windows XP
192 MB of RAM (256 MB recommended)
280 MB of available hard disk space
Color monitor with 16-bit or greater video card
1024x768 or greater monitor resolution
CD-ROM drive
Internet or phone connection required for product activation


Regards ;)
 
Back
Top