ScaleHeight, ScaleWidth Properties
See Also Example
Apply To
Form, MDI form
Description
Determine the number of units for the internal horizontal (ScaleWidth) and vertical (ScaleHeight) measurement of an object when using graphics methods 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 ScaleMode
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 ScaleTop 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 CurrentY settings will change to reflect the new coordinates of the current point.
You can also use the Scale
Note The ScaleHeight and ScaleWidth properties aren't the same as the Height and Width 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
Single
Help:
CurrentX, CurrentY Properties
DrawMode Property
DrawStyle Property
FillColor Property
ForeColor Property
Scale Method
ScaleLeft, ScaleTop Properties
ScaleMode Property
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