Adjusting VB for different screen resolutions
Author |
Message |
Ben Crai #1 / 6
|
 Adjusting VB for different screen resolutions
I have an extensive VB application under way (working title: Visual Tutorial in Options Pricing) that has many forms with lots of controls, graphics, and prints on the forms lots of formulae (with subscripts, superscripts for exponents, in small fonts), etc. All the labels, controls, lines, currentx & currenty for printing, etc., must be positioned just right on the form. I'm developing this on my monitor with screen resolution 800 by 600. Rather late in the day I'm horrified to realize that the size and position of the forms, position of controls and printing, etc., can be screwed up when the application is run on a different sized monitor (or is it just on a screen with different resolution?). I've downloaded a Microsoft paper on adjusting form size when this happens, but what about all the controls, print positions, etc? I would appreciate some idea of where to turn for info on dealing with this, and what the best strategy might be. Thanks, Ben Crain
|
Sun, 28 Jan 2001 03:00:00 GMT |
|
 |
John Tabo #2 / 6
|
 Adjusting VB for different screen resolutions
You have a couple of options. 1. Set your form for 800x600 and do not allow resizing of the form. While drastic, it is also the simplest. However, this solution is not without fault, either. If the user has a different system font, for instance, your labels, captions, etc. may be off a bit. 2. Write code to resize your controls when the form is resized. While tedious, this option provides the most flexibility. 3. Look for "elastic" controls that will automatically resize children controls. The issue you have discovered is certainly not new and is one that every multimedia developer has to contend with. VideoSoft makes a reasonably priced package called VsOCX which contains an elastic control. Again, this control is a container object similar to a picture box on which you place all your GUI controls. Whenever the form is resized, all the controls in the elastic control are resized, too. -- John Tabor
http://members.bellatlantic.net/~jftabor Quote:
>I've downloaded a Microsoft paper on adjusting form size >when this happens, but what about all the controls, print positions, >etc? I would appreciate some idea of where to turn for info on dealing >with this, and what the best strategy might be.
|
Mon, 29 Jan 2001 03:00:00 GMT |
|
 |
Moll #3 / 6
|
 Adjusting VB for different screen resolutions
Ben, There are a number of controls that can do what you want. The best one I have found is called FastForm, which is available from http://www.bigfoot.com/~ctsoftware. Other controls work in various ways, but this one just drops on the Form you want to control and can be used without any programming at all. It also supports things like scaling of all your controls graphics, fonts, borders - Form Zorder, save window, MDI Form size etc.. which no other control does to my knowledge. Using a control like this would suit you better that one that acts as a container for controls because you have already developed your forms. If you used a container type, you would have to modify all your forms to cut and paste the controls into the container. With this one you just need to drop a control onto each form that you want to scale. Regards Molly. Quote:
>I have an extensive VB application under way (working title: Visual >Tutorial in Options Pricing) that has many forms with lots of controls, >graphics, and prints on the forms lots of formulae (with subscripts, >superscripts for exponents, in small fonts), etc. All the labels, >controls, lines, currentx & currenty for printing, etc., must be >positioned just right on the form. I'm developing this on my monitor >with screen resolution 800 by 600. Rather late in the day I'm horrified >to realize that the size and position of the forms, position of controls >and printing, etc., can be screwed up when the application is run on a >different sized monitor (or is it just on a screen with different >resolution?). I've downloaded a Microsoft paper on adjusting form size >when this happens, but what about all the controls, print positions, >etc? I would appreciate some idea of where to turn for info on dealing >with this, and what the best strategy might be. >Thanks, Ben Crain
|
Mon, 29 Jan 2001 03:00:00 GMT |
|
 |
VBDi #4 / 6
|
 Adjusting VB for different screen resolutions
Quote: >I would appreciate some idea of where to turn for info on dealing >with this, and what the best strategy might be.
Depending on the layouts of your forms, some of the alredy mentioned custom controls can be used. But in special situations, it's not appropriate to simply scale all controls, according to the actual font settings. A general problem arises from pictures, consisting of a fixed number of pixels, and text, that has different size and height in pixels, depending on the screen resolution and setting of the font size. Bitmaps should never be zoomed or shrinked, so these have a different size in every graphics resolution. The only possible cure are multiple versions of every picture, with a different size in pixels. The size of fonts should never be changed, since it's the very personal adjustment of the user, how big a font of e.g. 10 points will be on his screen. Unfortunately Windows doesn't handle font sizes correctly with different graphics resolutions, so you must check and adjust any labels and other controls, that contain text, to make these never cut the contained text. Finally the forms must be adjusted to these settings. Most setup programs - to mention MS in the first place - either show truncated text on my system, or even worse, have buttons outside windows with fixed borders :-( Therefore I never use graphics in my forms, unless in toolbars, that automatically adjust themselves. All text areas are big enough, to hold the full text in (hopefully ;-) all resolutions. And I never use AutoSize, since this will guarantee truncated labels on any other system. DoDi
|
Wed, 31 Jan 2001 03:00:00 GMT |
|
 |
urud #5 / 6
|
 Adjusting VB for different screen resolutions
I have faced problems like this when I wrote ActiveX control for plotting and displaying Semi-Log Chart, what I have done is using scale factor for WIDTH and HEIGHT of the output. WidthFactor=( (Screen.Width /15 ) / 800) HeightFactor=( (Screen.Height /15 ) / 600) New_X = Old_X * WidthFactor New_Y = Old_Y * HeightFactor
|
Sun, 04 Feb 2001 03:00:00 GMT |
|
 |
VBDi #6 / 6
|
 Adjusting VB for different screen resolutions
Quote: >what I have done is using scale factor for >WIDTH and HEIGHT of the output.
Why didn't you use the built-in ScaleWidth/ScaleHeight factors? DoDi
|
Thu, 08 Feb 2001 03:00:00 GMT |
|
|
|