Solved

Rescale forms with diff. resolutions!!!

Posted on 2000-04-11
12
156 Views
Last Modified: 2010-05-02
I'm using VB6 & Win98 and I really need help.

I designed ALL my forms under screen resolution 1024*768.  The program works & looks fine until I change my resolution to 800*600:

All my forms don't fit within the monitor screen (e.g. the title bar is outside the top of the monitor screen, so I cannot even move the forms around).

(1) How to rescale every form automatically in VB when the screen resolution changes?  This of course includes rescaling all combo boxes, text boxes, etc.

(2) If it cann't be done automatically, what's the next best solution?

Tnx a lot,
0
Comment
Question by:leesss
  • 4
  • 3
  • 2
  • +3
12 Comments
 
LVL 10

Accepted Solution

by:
caraf_g earned 50 total points
ID: 2703844
The best solution (sorry) is to redesign your forms for 800x600 resolution, and then NOT rescale them at all for higher resolutions.

It will definitely be the solution most popular with your customers.
0
 
LVL 1

Author Comment

by:leesss
ID: 2703897
I've tried using the form.scalemode = pixel, but it doesn't seem to be any different than twips.
0
 
LVL 14

Expert Comment

by:mcrider
ID: 2703979
caraf_g is right... Always build your forms using the lowest resolution you will support.  That way, you *know* what it's going to look like.


Cheers!®©
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 2703981
Oh, it's quite different alright.
0
 
LVL 2

Expert Comment

by:Crin
ID: 2704215
Hello,

By the way, SOME part of the code is possible to write, BUT some controls width/height depends on system settings (for example ComboBox or ListBox)...

True solution was given by caraf_g: redesign your form in 800x600.

Also some tips:
keep in mind color settings, the same reason to use 16 colors if no needs to use True or HighColor
while design play with Display settings (mostly 'Appearence' tab) - change border width, Button face/font colors etc and check what happen t6o your forms...
To prevent color troubles you can use palette mode, not system colors...

Sincerely yours,

Crin

0
 
LVL 12

Expert Comment

by:mark2150
ID: 2704913
Rescaling the controls isn't hard. Tricky part is getting the text to come out right.

Bite the bullet, reset to the rez you originally used and then resize everything to fit at 800x600. This is why there is a "Form Layout Window" under the View option in the IDE. So you can make sure that a screen will fit OK when you build on a system with higher rez than your users will normally have.

M
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Expert Comment

by:justinflitcroft
ID: 2706441
To fix your problem, you should write a subroutine or function that positions all the controls on form load. You must do this not using absolute measurements, but multiples of Screen.TwipsPerPixelX or Screen.TwipsPerPixelY. You will have to determine the value of these variables on your system, and caculate the multiples based on this. For example, if one of your controls had a top value of 150, and your Screen.TwipsPerPixelX is 15, you would write code such as control.top = (Screen.TwipsPerPixelX * 10).
I hope this helps.
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 2706803
Nonsense.

If you do that, your forms are guaranteed to look non-standard the moment you resize them.

The problem with resizing forms is that certain controls should not resize. A typical example would be a check box or an option button. Frames normally don't resize either as they are like little sub-forms with their own optimised layout.

Other controls, such as list boxes and treeviews, can resize freely.

The controls that are not to be resized can often be placed in one of four regions:

1 Top Left - These controls do not move nor resize.
2 Top Right - These controls stay in the same top positions but stay "anchored" to the right hand border of the form.
3 Bottom Left - Controls stay in same Left position but are anchored to the bottom of the form
4 Bottom Right - Controls are anchored to bottom right hand corner.

The other controls can then be resized with the form.

You'd normally have to provide a minimum size for your form. Not provided in this example.

Check out http://homepage.eircom.net/~carafa/VBSamples/VB6/ResizeSample.frm for a slightly better solution.

0
 
LVL 1

Author Comment

by:leesss
ID: 2707971
Thanks for all the inputs, they are really helpful.  I'll wait for 1 more day before I honor my points.
0
 
LVL 1

Author Comment

by:leesss
ID: 2723806
justinflitcroft,

sorry that I have to reject your answer, since I believe caraf_g is right...

caraf_g, could you claim an answer so that I could honor your points
0
 
LVL 12

Expert Comment

by:mark2150
ID: 2723958
You can "Accept Comment as Answer" anytime.

M
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 2725767
Thanks a mill!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now