Solved

Rescale forms with diff. resolutions!!!

Posted on 2000-04-11
12
160 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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
 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

839 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