ScaleX, ScaleY Functions

Purpose

Converts the value for the width or height of a Form or Printer from one of the ScaleMode property's unit of measure to another. Named arguments are not supported.

Syntax

x! = [object.]ScaleX (width [, from] [, to])

y! = [object.]ScaleY (height, [, from] [, to])

x!, y!: Single exp
width, height: Single exp
from, to: iexp, ScaleMode constant

Description

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

The height and width parameters specify the number of units to be converted. The optional parameter from is a constant or value specifying the coordinate system from which width or height of object is to be converted. The optional parameter to is a constant or value specifying the coordinate system to which width or height of object is to be converted.

The possible values of from and to are the same as for the ScaleMode property: basUser, basTwips, basPoints, basPixels, basCharacters, basInches, basMillimeters, basCentimeters, and basHiMetric.

When from or to is omitted then the defaults are: from = basHiMetric and to = basUser. If one of the parameters basUser, then the value is converted using the current active Scale or ScaleMode setting of the Form or Printer.

Example

Local a$, i As Int, j As Int

AutoRedraw = 1

QBColor 0, 15

Cls

Restore

FontBold = True : Print "FROM \ TO"; : FontBold = False

For i = 1 To 8 : Read a$ : Print _Tab(i * 13); : FontBold = True : Print a$; : FontBold = False : Next i : Print

Restore

For i = 1 To 8 : Read a$

FontBold = True : Print a$; : FontBold = False

For j = 1 To 8

QBColor i = j ? 13 : 0

If i = 3 Or j = 3 : QBColor , 7

a$ = Space(25) : Lset a$ = ScaleX(1, i, j)

Else : QBColor , 15 : a$ = ScaleX(1, i, j)

EndIf

Print _Tab(j * 13); a$;

QBColor , 15

Next

Print

Next

Data "Twips","Points","Pixels","Characters","Inches","Millimeters","Centimeters","HiMetric"

Do

Sleep

Until Me Is Nothing

See Also

Form, Printer, ScaleMode, ScaleMode$, Scale, ScaleWidth, ScaleHeight, OcxScale, ScaleToDPi, ScaleXYWHToDpi, WM_DPICHANGED.

{Created by Sjouke Hamstra; Last updated: 09/05/2020 by James Gaite}