• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 603
  • Last Modified:

VB Form design.

My program contains a form, one textBox, one command button and  one label.
My problem is I want to stretch or shrink on run time and I want all the controls
In the form to resize specially the fonts. I would like also to know how to approach
The problem of running the program in different machines with different font and
Resolution configurations.
If I don’t allow the form to resize dynamically how should I start it  at the beginning with
A reasonable size and font? How should I inquire at installation time the state of the machine
Like the size of the screen, the resolution and the font size it is using and then using that
Information to size my forms and the controls on them.
I want a general advice and where to look for information about that and may be some example code
If possible.  I am a programmer but just started learning VB5-6.
I tried the domo program from videosoft vsElasticLight but It is not working fine for me specially
Fonts and when I run my program with other machines with different settings.

Thank You
1 Solution
Hmmm, I've faced that problem several times in proffessional applications and this is what I think: You don't need to stretch or rezise the form depending on the screen resolution, the only thig you have to take care is that your non-rezisable windows do not pass 640 x 480 pixels. Your dialog will be fine in any computer...If you enlarge your forms on high-resolution screens, your dialogs will look ugly and with a lot of wasted space... It's very simple, if your app is running on a high resolution screen, your dialog will "appear" smaller than in a low resolution screen, but it will look nice, if you enlarge the controls and the fonts, your app will look like a program for babies... but as I said before, that's just my opinion.
You can make use of the autosize feature of an invisible label. Just increase the font size of this label and see how big it is now.
Yassin, don't change the size. People are buying larger monitors and using better resolution to see more information, not to see enlarged information.
Always program to fit 640*480 screen, as trillo said.
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

In my code I've gone the full resize option a couple of times. I design at 640x400 and scale up from there as the screen rez increases. If you have a main module you can do the work in there before the forms become visible. You can scale up the .Width and .Height properties. Fonts, however, are another issue. If you pick a decent true type font you can scale up as required, but due to the nature of proportional fonts not all scalings will look good. You can do stuff with the .FontSize property but some fonts seem to jump quite a bit for a small (2pt) size change. Additionally some fonts automatically switch to a BOLD version when their font size increases past a certain point and this can cause your prompts to suddenly expand beyond their intended boundaries.

Ameba makes a good point, if you scale up your app's screen real estate as the rez goes up the user is not going to gain any benefit from their investment in larger monitor/better video if every program auto scaled.


Mirkwood, you are truely some thing.
I once heard a saying from one math professor in the uni:
Every complicated question has one short simple and wrong answer.
Think about it a while and go back to read you comment in this thread.
yassin092898Author Commented:
This is Yassin the owner of this complicated question.
I think the following comments from Trilo and  ameba
gave the best hint.
"You don't need to stretch or rezise the form depending on the screen resolution, the only thig you have to take care is that your non-rezisable windows do not pass 640 x 480 pixels" ..trilo

and "Always program to fit 640*480 screen, as trillo said." ..ameba

I thank Mirkwood's comment but that applies to test example I
already tried before I posted this question and it is the only
question I looked and couldn't figure out how I can make use
of it.
Zivf good comment and you gave me a valuable hint, could you
advice too.

Now I must tell you that this is my first attempt in writing
an application of this requirement.
what does  "Always program to fit 640*480 screen" mean.
 My machine is 17", 1024X768, and at design time my main form fits nicely.
Do I have to do any setting at design time or do I have to do some coding?
Thank You All

yassin092898Author Commented:
Adjusted points to 180
>1024X768, and at design time my main form fits nicely

You must test your program with other resolutions (640*480,800*600).
Check also another Appearance Scheme (I use normally "Windows Standard", and check releases with "Rainy Day" scheme)
Sometimes I check software also with "Large Font" setting.

If you check this things, you will not have users' calls with problems like: wrong size of your Splash screen, wrong colours, or "does not fit" problems.

It is very common mistake to have large data entry screens with  15 or more entry fields per screen. If you have this, use Tabstrip control. To see how it works, add Options form (it is in your Form templates). You can see its use in e.g. Address Book in Outlook Express, or in any OS Properties window.

Of course, you can allow your users to use more then 640*480 if they want - like in Notepad, or with lists. Use resize event to position/resize your control(s).

For fixed-size forms, do not go over: 640x452 pts
For fixed-size MDI-Childs, do not go over: 600x390 pts

There are some rare possible situations, e.g. your client has requirement to see list of Customers, Customers details, list of Orders and Graph of payments on one screen, then use 800x600. But be aware that your software will not show well on most Laptops and some PCs with 14' screens. You can add this line to your startup form:
    If Screen.Width  <  800 * Screen.TwipsPerPixelX  Then
        MsgBox "This software requires better resolution. ..."
    End If

And don't be bothered with a lot of free space on your 17'. Most users will rarely run only one program at the same time.

yassin092898Author Commented:
Ameba thanks for your effort and I thank the many other experts who adviced me in this question. Anyone can still add some more comments but I want to stop adding any more cooments. I am ready
to award the points and full marks but someone has to claim I think.

>someone has to claim I think
No problem.

PAQ (previously asked questions) readers: See comments

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now