ScaleLeft, ScaleTop Properties
See Also Example
Apply To
Form, picture box
Description
Determine the horizontal (ScaleLeft) and vertical (ScaleTop) coordinates for the left and top edges of an object when using graphics methods The default for both properties is 0.
Usage
{ [form.][picturebox.]|Printer.}ScaleLeft[ = numericexpression ]
{ [form.][picturebox.]|Printer.}ScaleTop[ = numericexpression ]
Remarks
Using these properties and the related ScaleHeight and ScaleWidth These four 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. The CurrentX and CurrentY property settings will change to reflect the new coordinates of the current point.
You can also use the Scale
Note The ScaleLeft and ScaleTop properties aren't the same as the Left and Top properties.
Data Type
Single
Help:
DrawMode Property
DrawStyle Property
FillColor Property
ForeColor Property
Left, Top Properties
Scale Method
ScaleHeight, ScaleWidth Properties
ScaleMode Property
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