Improve company productivity with a Business Account.Sign Up


VB Form design.

Posted on 1998-11-27
Medium Priority
Last Modified: 2013-12-03
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
Question by:yassin092898

Expert Comment

ID: 1447165
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.
LVL 13

Expert Comment

ID: 1447166
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.
LVL 15

Expert Comment

ID: 1447167
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.
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

LVL 12

Expert Comment

ID: 1447168
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.



Expert Comment

ID: 1447169
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.

Author Comment

ID: 1447170
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


Author Comment

ID: 1447171
Adjusted points to 180
LVL 15

Expert Comment

ID: 1447172
>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.


Author Comment

ID: 1447173
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.

LVL 15

Accepted Solution

ameba earned 720 total points
ID: 1447174
>someone has to claim I think
No problem.

PAQ (previously asked questions) readers: See comments

Featured Post

Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to and use offer code ‘EXPERTS’ to get 10% off your first purchase.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

584 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question