|
|
Title | Print multiline text at a specific location on a form or printer by using the ScaleLeft property |
Description | This example shows how to print multiline text at a specific location on a form or printer by using the ScaleLeft property in Visual Basic 6. The program sets the Printer object's ScaleLeft property to position X = 0 where the text should be aligned. |
Keywords | print, multiline, ScaleLeft, align, printer |
Categories | Graphics |
|
|
The program sets the Printer object's ScaleLeft property to -2 * 1440. That makes X = 0 where the text should be aligned, two inches to the right of the printable area's left edge.
|
|
Private Sub cmdPrint_Click()
' Draw the target area.
Printer.Line (2 * 1440, 5 * 1440)-Step(3 * 1440, 0)
Printer.Line (2 * 1440, 5 * 1440)-Step(0, 3 * 1440)
' Set ScaleLeft to -2 inches. That places X = 0
' two inches to the right of the left edge.
Printer.ScaleLeft = -2 * 1440
' Print some text.
Printer.CurrentY = 5 * 1440
Printer.Print _
"When in worry" & vbCrLf & _
"or in doubt" & vbCrLf & _
"run in circles" & vbCrLf & _
"scream and shout"
Printer.EndDoc
MsgBox "OK"
End Sub
|
|
|
|
|
|