borderAndreaVB free resources for Visual Basic developersborder

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

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Print with overlays)Next Topic (Printer status) New Topic New Poll Post Reply
AndreaVB Forum : Printing : printing alignment
Poster Message
stacey5512
Level: Guest


icon printing alignment

Question...

I am currently using the "printer.print" functions to print "static text" along with variable data that is stored in a database with column headers.  Is there anyway to apply character styles like bold, underline, italics within a line; for example; printer.print <BoldON> "My text goes here" <BoldOff>?

Also, if you are using a font like times roman, how can you figure right alignment if the characters are not = in width?

Thanks.

11-08-2003 at 07:47 PM
| Quote Reply
Shady
Level: VB Guru


Registered: 08-07-2002
Posts: 305
icon Re: printing alignment

Hi there stacey,

I'm a little rusjed at the moment, but stick the following code underneath a button, and try it out, it should be all the code you need to invoke BOLD/ITALICS etc, and it will right align your text.

Private Sub Command1_Click()

Printer.FontName = "Times New Roman"
Printer.FontSize = "16"

Printer.CurrentX = Printer.ScaleWidth - Printer.TextWidth("123456")
Printer.Print "123456"

Printer.FontBold = True

Printer.CurrentX = Printer.ScaleWidth - Printer.TextWidth("12345")
Printer.Print "12345"

Printer.FontBold = False
Printer.FontItalic = True

Printer.CurrentX = Printer.ScaleWidth - Printer.TextWidth("1234")
Printer.Print "1234"

Printer.FontItalic = False
Printer.FontUnderline = True

Printer.CurrentX = Printer.ScaleWidth - Printer.TextWidth("123")
Printer.Print "123"

Printer.FontUnderline = False

Printer.EndDoc

End Sub


Any problems, post back

Regards

Shady

____________________________
I don't wanna die... but I ain't keen on livin' either

12-08-2003 at 08:57 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Printing : printing alignment
Previous Topic (Print with overlays)Next Topic (Printer status) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

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