Visual Basic Reference

ScaleX, ScaleY Methods

See Also    Example    Applies To

Converts the value for the width or height of a Form, PictureBox, or Printer from one of the ScaleMode property's unit of measure to another. Doesn't support named arguments.

Syntax

object**.ScaleX(width, fromscale, toscale)**

object**.ScaleY(height, fromscale, toscale)**

The ScaleX and ScaleY method syntaxes have these parts:

Part Description
object Optional. An object expression that evaluates to an object in the Applies To list. If object is omitted, the Form object with the focus is assumed to be object.
width Required. Specifies, for object, the number of units of measure to be converted.
height Required. Specifies, for object, the number of units of measure to be converted.
fromscale Optional. A constant or value specifying the coordinate system from which width or height of object is to be converted, as described in Settings. The possible values of fromscale are the same as for the ScaleMode property, plus the new value of HiMetric.
toscale Optional. A constant or value specifying the coordinate system to which width or height of object is to be converted, as described in Settings. The possible values of toscale are the same as for the ScaleMode property, plus the new value of HiMetric.

Settings

The settings for fromscale and toscale are:

Constant Value Description
vbUser 0 User-defined: indicates that the width or height of object is set to a custom value.
vbTwips 1 Twip (1440 twips per logical inch; 567 twips per logical centimeter).
vbPoints 2 Point (72 points per logical inch).
vbPixels 3 Pixel (smallest unit of monitor or printer resolution).
vbCharacters 4 Character (horizontal = 120 twips per unit; vertical = 240 twips per unit).
vbInches 5 Inch.
vbMillimeters 6 Millimeter.
vbCentimeters 7 Centimeter.
vbHimetric 8 HiMetric. If fromscale is omitted, HiMetric is assumed as the default.
vbContainerPosition 9 Determines control's position.
vbContainerSize 10 Determines control's size.

Remarks

The ScaleX and ScaleY methods take a value (width or height), with its unit of measure specified by fromscale, and convert it to the corresponding value for the unit of measure specified by toscale.

You can also use ScaleX and ScaleY with the PaintPicture method.