Google Answers Logo
View Question
 
Q: Screen Size (VB6) ( No Answer,   3 Comments )
Question  
Subject: Screen Size (VB6)
Category: Computers > Programming
Asked by: jstm-ga
List Price: $20.00
Posted: 07 Mar 2005 08:04 PST
Expires: 06 Apr 2005 09:04 PDT
Question ID: 486142
I wrote a VB6 program on a laptop and when I installed on a desktop PC
the sceen does not fit. The user does not want to change their pixels
size? How can I make my program resize automatically regardless what
the computer display pixels are set?
Answer  
There is no answer at this time.

Comments  
Subject: Re: Screen Size (VB6)
From: dound-ga on 07 Mar 2005 10:12 PST
 
Well, the hardest part is finding the size of their screen (really,
the resolution they're viewing at).  To do this in VB, use the
following:

  TWidth = Screen.Width \ Screen.TwipsPerPixelX
  THeight = Screen.Height \ Screen.TwipsPerPixelY

TWidth and THeight will now be something like 640 and 480, etc --
whatever the user has their resolution to.  Using this you should be
able to size your form/window to whatever is appropriate for your
program.

The width/height of your program can be set by doing the following:

    Me.width = some_number
    Me.height = some_number

The units for height and width are by default in "twips" though you
can change the form's scale mode to "pixels" (might be easier to scale
with the resolution which is typically given in pixels).

Me.scaleMode = 1 'default (twips)
Me.scaleMode = 3 'pixels


Please let me know if you need anything else.
Subject: Re: Screen Size (VB6)
From: jstm-ga on 09 Mar 2005 07:47 PST
 
I'm still lost. Some users have their resolution (pixels) set at
800/600 and others at 1024/768. Is there a way to just add a few lines
of code to the program that will automatically scale it to the
resolution the user is set?

Will I have to redesign all the forms to fit the different screen resolutions?
Subject: Re: Screen Size (VB6)
From: hammer-ga on 09 Mar 2005 09:31 PST
 
Jstm,

This functionality is something of a holy grail. It's very difficult
to do well.  Most people who have fought this fight just design for
the lowest expected resolution, in your case, 800x600.

You can also look into third party resizer controls that handle this
semi-automatically. Here is a short list of avaialble resizer
controls.There are others.
http://www.vbxtras.com/categories/Resizer.asp

- Hammer

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy