ScaleLeft, ScaleTop Properties

See AlsoVFFNNR              Example3N8RDWR>Low

Apply To

Form14TJ2LN, picture box31MYIWX, Printer objectCBQUDQ.


Determine the horizontal (ScaleLeft) and vertical (ScaleTop) coordinates for the left and top edges of an object when using graphics methodsAY3LGR or when positioning controls.  The default for both properties is 0.


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

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


Using these properties and the related ScaleHeight and ScaleWidth3J8U7ZN properties, you can set up a full coordinate system with both positive and negative coordinates.  These four scale properties interact with the ScaleMode5SNY0BP 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.  The CurrentX and CurrentY9TOITD property 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 ScaleLeft and ScaleTop properties aren't the same as the Left and Top1CIZPD6 properties.


Data Type


See Also


DrawMode Property2ZATBSD

DrawStyle Property4PNS0NQ

FillColor PropertyL2TW7M

ForeColor Property1W9T6JQ

Left, Top Properties1CIZPD6

Scale MethodQ2ADWT

ScaleHeight, ScaleWidth Properties3J8U7ZN

ScaleMode Property5SNY0BP


Programmer's Guide:

Chapter 15, "Creating Graphics for Applications"

ScaleLeft, ScaleTop Properties Example

The example creates a grid in a picture box and sets coordinates for the upper-left corner to -1, -1 instead of 0, 0.  Every quarter second, dots are randomly plotted from the upper-left corner to the lower-right corner.  To try this example, paste the code into the Declarations section of a form that contains a large picture box and a timer control.  Then press F5 and click the form.

Sub Form_Load ()

   Timer1.Interval = 250                 ' Set timer interval.

   Picture1.ScaleTop = -1                ' Set scale for top of grid.

   Picture1.ScaleLeft = -1               ' Set scale for left of grid.

   Picture1.ScaleWidth = 2               ' Set scale (-1 to 1).

   Picture1.ScaleHeight = 2

   Picture1.Line (-1, 0)-(1, 0)          ' Draw horizontal line.

   Picture1.Line (0, -1)-(0, 1)          ' Draw vertical line.

End Sub


Sub Timer1_Timer ()

   Dim I                                 ' Declare variable.

   ' Plot dots randomly within a range.

   For I = -1 To 1 Step .05

      Picture1.PSet (I * Rnd, I * Rnd)   ' Draw a point.

   Next I

End Sub