Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

form developed on 19" monitor doesn't work on 14" 2

Status
Not open for further replies.

cateyes

Programmer
Jun 14, 2002
9
0
0
CY
I developed a group of complex forms while using a computer with a 19" monitor. I created an executable and when I run the program on a computer with a 17" monitor it works fine. When I run the executable on my HP portable which has a 14" monitor, I only see a portion of the form.

I have set the screen area on the portable to the maximum area via Settings but this doesn't help.

I don't have time to recreate the forms. Can anyone help me?
thankyou
 
The issue shouldn't be the size of the monitor, but rather its resolution. If the 14" monitor has a maximum display resolution of 800x600, and your 17" and 19" monitors are using 1024x768, and the application was developed for 1024x768, then you will have a problem.

There are a couple of things that you can - you could dynamically resize all of the controls, based on the current screen resolution.

There are also some downloadable controls that perform this resize function. Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
You can add some scroll bars to your forms and then scroll your controls through code so that you can show as much of the form as possible then let the user scroll for the rest.

It is always a good idea to design a form with the minimum requirements in mind. In an ideal world everyone would have a huge monitor and superfast PC, but this like many things in life just doesn't happen.
I always try to design forms to fit 800 x 600. You would be suprised how many people still use that.

Matt

PS if you need an example reply and I'll post something.
 
Didn't get to finish my post

If you want to try and resize the controls yourself, the algorythm is fairly straightforward, but there are a number of pitfalls that you need to be aware of.

First, calculate a HeightFactor and a WidthFactor.

dim HeightFactor as Single
dim WidthFactor as Single

HeightFactor = NewWindowHeight / OldWindowHeight
WidthFactor = NewWindowWidth / OldWindowWidth

Loop thru your controls collection, and for each that apply, call the following subroutine passing the control and a byref parameter.

dim TheControl as Control

For Each TheControl in Me.Controls
SizeThisControl ThisControl
Next

Private Sub SizeThisControl(ControlID As Control)

On Error GoTo HandleError

Dim NewWidth As Long
Dim NewTop As Long
Dim NewLeft As Long
Dim NewHeight As Long

With ControlID
NewTop = Int((.Top * gHeightFactor) + 0.5)
NewHeight = Int((.Height * gHeightFactor) + 0.5)
NewLeft = Int((.Left * gWidthFactor) + 0.5)
NewWidth = Int((.Width * gWidthFactor) + 0.5)
.Top = pLng_NewTop
.Left = pLng_NewLeft
.Width = pLng_NewWidth
.Height = pLng_NewHeight
End With

Exit Sub

HandleError:

Resume Next

End Sub

Some of the pitfalls that you need to be aware of:

1. Watch out for FontSize - you may or may not want to adjust the .FontSize property, but not all controls have that property.

2. If you controls are on tabs, then if would not be a good idea to adjust the size and/or position of that control unless you are actually on that tab.

3. You may have events triggered on the controls as they are moved and resized, so you need to handle those.

4. Be sure to keep the error handler because of such things as "Left Property cannot be read a run-time" -- this will happen if your control happens to be a timer.


As far as downloading, I would search for some examples. Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
You could set the StartUpPosition property of the form to CenterScreen. Or you can set the WindowState to Maximized.

Greets,
Jan If this response was usefull to you, please mark it with a Star!
 
Neither centering nor WindowState = Maximized does anything for oversized forms on lower resolution monitors. The only solution is resizing. If you have an SSTAB, controls on non-active tabs have a LEFT=(75000 - original) so you must activate each TAB before resizing the copntrols on it. Change your fonts to True Type which are resizable. Fonts like MS Sans Serif (defualt) are not resizable per se. They are in a set of fixed sizes e.g. 8.25, 9.75 with nothing in between. And then there are images, cell sizes in grids... etc etc. I know, I've done it and am still learning. Generate Forms/Controls Resizing/Tabbing Class
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
thanks everyone for your help, I will try to resize using your code CajunCenturion. I'll let you know how it goes. Thank you for being so much help! I really appreciate it!
Cateyes
 
JohnYingling,
I just got your comments and they really helped. I have alot of tabs, so this was a problem for me. Thanks for the links too!
 
Microsoft do like complicating things so...

Exactly the same effect can be achieved with the addition of exactly no code or extra controls to a program. The technique is described at the bottom of this thread: thread222-320922

Note that both the above and the Microsoft solution are simply designed to allow you effectively increase the usable area of a form by enabling scrolling. Neither of them try to fit a large form into a smaller area, which the earlier solutions in this thread are discussing.

The decision as to whether scrolling or resizing best meets the application requirements is, of course, up to the programmer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top