borderAndreaVB free resources for Visual Basic developersborder

AndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2008 Andrea Tincani
:: 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

:: Navigation

Home

Printing Using Visual Basic

Previous Tip

Next Tip

:: Search this site
Google
:: Related Topics
icon 12-05-2008 Re: Printer.? by BobBarker
icon 10-04-2008 Re: Reading modifing text files by admin
icon 02-02-2008 Re: How to connect in Excel by noknok
icon 02-02-2008 How to connect in Excel by noknok
icon 16-01-2008 Re: Find record, multiple result by yronium
Partners: Il portale per lui e lei | Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2008 Andrea Tincaniborder