Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitlePrint multiline text at a specific location on a form or printer by using the ScaleLeft property
DescriptionThis 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.
Keywordsprint, multiline, ScaleLeft, align, printer
CategoriesGraphics
 
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
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated