Visual Basic Reference
Return or set the number of units for the horizontal (ScaleWidth) and vertical (ScaleHeight) measurement of the interior of an object when using graphics methods or when positioning controls. For MDIForm objects, not available at design time and read-only at run time.
object.ScaleHeight [= value]
object.ScaleWidth [= value]
The ScaleHeight and ScaleWidth property syntaxes have these parts:
|Object||An object expression that evaluates to an object in the Applies To list.|
|Value||A numeric expression specifying the horizontal or vertical measurement.|
You can use these properties to create a custom coordinate scale for drawing or printing. For example, the statement
ScaleHeight = 100 changes the units of measure of the actual interior height of the form. Instead of the height being n current units (twips, pixels, ...), the height will be 100 user-defined units. Therefore, a distance of 50 units is half the height/width of the object, and a distance of 101 units will be off the object by 1 unit.
Use the ScaleMode property to define a scale based on a standard unit of measurement, such as twips, points, pixels, 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 ScaleTop 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. A ScaleMode of 0 is user-defined.
- 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 change to reflect the new coordinates of the current point.
You can also use the Scale 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 Width properties.
For MDIForm objects, ScaleHeight and ScaleWidth refer only to the area not covered by PictureBox controls in the form. Avoid using these properties to size a PictureBox in the Resize event of an MDIForm.