| :: Print a Text with a specific alignment (left, Right or Center) |
Author |
Andrea Tincani |
Language |
VB5, VB6 |
Operating
Systems |
Windows 95, 98 and NT |
| Module |
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 |
| Usage |
PrintAlignedText "Centered Text", vbCenter |
|
 |
|
 |