Solved

Rescale forms with diff. resolutions!!!

Posted on 2000-04-11
12
158 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

920 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

12 Experts available now in Live!

Get 1:1 Help Now