ScaleHeight, ScaleWidth Properties

See Also12QODLS              Example14XLYBJ>Low

Apply To

Form14TJ2LN, MDI form1ILMZQ7, picture box31MYIWX, Printer objectCBQUDQ.

Description

Determine the number of units for the internal horizontal (ScaleWidth) and vertical (ScaleHeight) measurement of an object when using graphics methodsAY3LGR or when positioning controls.  For MDI forms, not available at design time and read-only at run time.

Usage

{ [form.][picturebox.]|Printer.}ScaleHeight[ = numericexpression ]

{ [form.][picturebox.]|Printer.}ScaleWidth[ = numericexpression ]

Remarks

You can use these properties to create a custom coordinate scale for drawing or printing.  For example, the statement ScaleHeight = 100 defines the internal height of a section as 100 units, or one vertical unit as 1/100 of the height.

Use the ScaleMode5SNY0BP property to define a scale based on a standard unit of measurement, such as twips2SWJ8D3, points95MO9S3, pixelsZ40N3B, characters, inches, millimeters, or centimeters.

Setting these properties to positive values makes coordinates increase from top to bottom and left to right.  Setting them to negative values makes coordinates increase from bottom to top and right to left.

Using these properties and the related ScaleLeft and ScaleTop138Z3ME properties, you can set up a full coordinate system with both positive and negative coordinates.  All four of these scale properties interact with the ScaleMode property in the following ways:

         Setting any other scale property to any value automatically sets ScaleMode to 0.

         Setting ScaleMode to a number greater than 0 changes ScaleHeight and ScaleWidth to the new unit of measurement and sets ScaleLeft and ScaleTop to 0.  In addition, the CurrentX and CurrentY9TOITD settings will change to reflect the new coordinates of the current point.

 

You can also use the ScaleQ2ADWT method to set the ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties in one statement.

 

Note   The ScaleHeight and ScaleWidth properties aren't the same as the Height and WidthL14VJZ properties.

For MDI forms, ScaleHeight and ScaleWidth refer only to the area not covered by picture boxes in the form.  Avoid using these properties to size a picture box in the Resize event of an MDI form.

 

Data Type

Single6H5W9RZ


See Also

Help:

CurrentX, CurrentY Properties9TOITD

DrawMode Property2ZATBSD

DrawStyle Property4PNS0NQ

FillColor PropertyL2TW7M

ForeColor Property1W9T6JQ

Scale MethodQ2ADWT

ScaleLeft, ScaleTop Properties138Z3ME

ScaleMode Property5SNY0BP

 

Programmer's Guide:

Chapter 15, "Creating Graphics for Applications"


ScaleHeight, ScaleWidth Properties Example

The example uses the ScaleHeight and ScaleWidth properties to change the vertical and horizontal units of measurement for a form.  To try this example, paste the code into the Declarations section of a form.  Then press F5.  To see the effect, click the form, resize it, then click it again.

Sub Form_Click ()

   Dim Radius As Integer                 ' Declare variable.

   ScaleHeight = 100                     ' Set height units.

   ScaleWidth = 100                      ' Set width units.

   For Radius = 5 to 50 Step 5

      FillStyle = 1

      Circle (50, 50), Radius            ' Draw  circle.

   Next Radius

End Sub