Link to home
Start Free TrialLog in
Avatar of spoowiz
spoowizFlag for United States of America

asked on

Why does width and scalewidth properties return same value for a form?

   w = frmResPro.ScaleWidth
    w2 = frmResPro.Width
returns same value. Values listed in the form's properties window shows that they are different.
thanks.
Avatar of KarcOrigin
KarcOrigin

Try this:

1. Just check the ScaleMode of the form. Set it to 1-TWIP.
2. Set ScaleWidth and Width of the form at the design time. Now run the form and check the values.

Thanks
What variable type is w and w2 defined as ?
Avatar of spoowiz

ASKER

karc - it is set to 1-twip. i'm check the form's width and scalewidth from another form.
redford - long
This is how it's supposed to work. The ".ScaleMode" property of the Screen object (although it doesn't actually have one) is Twips, and there's nothing really that can be done about it. So the .Width and .Height properties of a form will always be in Twips (pixels * 15).

If you want the .ScaleWidth and .ScaleHeight properties of a form to be in Pixels, set it's ScaleMode property to 3.

-Burbble
Avatar of spoowiz

ASKER

burbble - the "problem", if it is a problem, is that scalewidth and width both return the same values (value of scalewidth). i'm looking to obtain the form.width value.
OH, I understand. Sorry ;-)

Does this only happen on the one project?

If you start a new Standard EXE project, add the line:

    MsgBox Form1.Width & "," & Form1.ScaleWidth

and run it, are they the same value?

What does...

    MsgBox Screen.TwipsPerPixelX & "," & Screen.TwipsPerPixelY & vbNewLine & Screen.Width & "," & Screen.Height

...return?

-Burbble


There are only 2 conditions that I can think of where the ScaleWidth and Width of a form can be the same:

1. The borderstyle of the form is set to 0 - None
2. The ScaleWidth property is set (in runtime or design time) to equal the Width (forcing the ScaleMode to 0 - User)

Avatar of spoowiz

ASKER

burbble -
>MsgBox Screen.TwipsPerPixelX & "," & Screen.TwipsPerPixelY & vbNewLine & Screen.Width & "," & Screen.Height
it says:
15,15
15360,11520

erik-
borderstyle was 0. when i changed to borderstyle 1, scalewidth and width showed the "correct" numbers.
so what does the borderstyle have to do with it?
what is the difference between scalewidth and width?

increasing points to 150
ASKER CERTIFIED SOLUTION
Avatar of Erick37
Erick37
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial