
MDI and child forms change relative sizes on different PC/Monitors
Quote:
> How can I make my MDI & child forms keep their same
> relative sizes on different computers/monitors? My MDI
> child form is adjusted to fill the MDI area exactly when it
> is loaded. It has an SSTab control on it. The child's width
> and height are adjusted in form_load to fill the MDI area
> perfectly when run in the VB6 environment and as an
> installed EXE. My PC monitor is a CRT: 1024 X 768
> Then I install it on a different PC with an LCD
> 1280 X 1024 monitor. On this monitor the child form is
> about 10% larger than the MDI area, which brings up
> both horizontal and vertical scrollbars.
For Forms of such a small size as yours (8780 x 6750 twips) the difference
in screen pixel area (1024 x 768, 1280 x 1024, etc) is itself unlikely to
cause any problems regarding the initial display size of the Form unless on
the target machine the screen pixel area is extremely small (less than 800 x
600 pixels) or the dpi resolution is extremely large (more than 120 pixels
per logical inch). However, other things can affect the relative sizes, even
with small Forms, and in general you should take such things into account in
your code. For example, you shouldn't really set a Form's Width or Height to
a specific value without first checking (in your code) that there is
sufficient space on the display, or at the very least checking the values
after you have set them to ensure that they are actually what you set them
to. Neither should you hard code any values which assume that a Form's
borders or caption bar are a specific size, because such things are likely
to be a different thickness on different machines. Your problem, with the
code as you have shown it, may be down to the target machine running at a
different pixels per logical inch setting or it may simply be that the
borders are a different thickness anyway on that machine, even if it is
running at the same pixels per logical inch setting. I don't usually use MDI
Forms myself, and I know they behave slightly different than a SDI Form in
various ways with respect to things like Status Bars etc, but you should be
able to get the initial conditions right on all machines (at least with your
initial 8780 x 6750 twip main Form size) by setting the child Form so that
it fills the available ScaleWidth and ScaleHeight. To do it correctly you
need to make sure that the main Form is fully shown before loading and
sizing the child Form, and a Me.Show in the main Form's Load event should do
this for you. You haven't said anything about the code you may have in the
various Resize events, but assumning you are not doing anything wrong there
then you should get the initial display conditions correct by doing
something like:
==== In MDIForm1_load
Me.Width = 8780
Me.Height = 6750
Me.Show
' now load the child Form
==== In the child form_load:
Width = MDIForm1.ScaleWidth
Height = MDIForm1.ScaleHeight
If that doesn't work then temporarily remove all code from both Resize
events, and possibly both Paint events depending on what you've got in
there, (code which you haven't yet shown us) and try it again.
Mike