Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

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.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Suggested Courses

671 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