Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> Visual Basic >> Snippet

Print text, positioined, justified and size


Public Sub PrintAlignedText(s As String , Alignment As AlignmentConstants)
Select Case Alignment
Case vbCenter
Printer.CurrentX = (Printer.ScaleWidth - Printer.TextWidth(s)) \ 2
Case vbLeftJustify
Printer.CurrentX = 0
Case vbRightJustify
Printer.CurrentX = Printer.ScaleWidth - Printer.TextWidth(s)
End Select
Printer. Print s
End Sub


PrintAlignedText "Centered Text" , vbCenter