Screen Resolution - Dumb Question

OK, I have made several pretty cool applications.

However, if someone uses a different Screen Resolution
then my application looks too big or too small.

In other words, I'm using and programming for 800x600.
If a user has 640x400 then he only see's 3/4 of my
application screen. If the User has 1200x1000 screen res
or whatever, then my application appears very small and
only partially fills the screen, leaving lots of dead space.

I always thought Windows was supposed to take care of that.
Why doesn't it? How do I make it do that?
We don't have to program for each screen resolution do we?
That would just be stupid!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

If you are programming for Windows, do it proper. In Windows, generaly, there is no place for resizing and repositioning controls. Every program must fit to 640*480 resolution.

When user changes resolution to e.g. 1280*960, he/she wants to see more information, not your enlarged information.

There are some resize.ocx-es on the market. They are catching
non-windows programmers, used to do their applications full-screen.

If you have data-entry screen with a lot of fields, do not enlarge your forms, use Tabstrip control instead. This will keep your forms small enough to fit 640x480.

This is a general rule. Exceptions are: setup programs, screen savers and some games. Full-screen can be OK for these applications.
get the screen.width and screen.height values and use them to scale your application. it works perfectly.
jgoreAuthor Commented:
How do I do that?
I know how to get the screen.width and screen.height, but what then?
How do I use them to scale my application?
Your answer is more than a little vague. I need details, or code, or something!
Thanks for any reply................

P.S. It's really very confusing:
We have Screen.height, Screen.width, form1.height, form1.width,
form1.scaleheight, form1.scalewidth and probably some other crap!
What do I do with it all?
Totally disregard what the resolution of the graphics card is set to.  You need to write code in the resize event of your main form (or, really, any resizeable window) to size relevant controls to useful sizes relative to the size of the main form.

For example, let's say that your main form has a ListView in the top half and the bottom half is dominated by a bunch of TextBoxes(single-line).  When your user resizes this window, what do you think should happen?  I think the ListView in the top should grow/shrink as a the size of the form changes.  Why?  Because it makes sense to grow and shrink The listview (it can show more data as it grows, but less so the TextBox-dominated part of the window.  It may make sense to make the TextBoxes wider or narrower depending upon the size of the window, but it's a less certain thing.

Now, how to write this code?

Key everything off of Form.Width and Form.Height.  Your code will look something like:


'Resize important controls relative to size of window
Sub Form1_Resize()
  Const TB_AREA_HEIGHT = 200 'Size of "TextBox Area" Height
  Const BREATHING_ROOM = 100 'Room between controls
                             'and edge of form

  'Only resize controls if not minimized (safest way)
  If Me.WindowState <> vbMinimized Then
    'Size ListView to take up majority of window
    ListView1.Height = Me.Height - TB_AREA_HEIGHT
    ListView1.Width = Me.Width - BREATHING_ROOM

    'Size Width of one TextBox, because it sometimes holds
    'long data
    TextBox4.Width = Me.Width - BREATHING_ROOM
  End If

End Sub


I just made this code up off the top of my head, so don't paste it into a form and expect it to work perfectly.  It's just an example of the kind of thing you'd do.  I'm currently working on an app that has a horizontal splitter that I wrote in VB, and it has tons of resizing code due to splitter position changes, form resizing, etc.  It's just what you do.

Good luck...

Mike Thomas
Digital Answers, LLC

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.