devxlogo

Printer Object Quirk

Printer Object Quirk

You would think that the following code would change the current fontof the default printer, but it doesn’t under VB4:

 Printer.FontName = "Arial"Printer.FontSize = 11Printer.Print "This is a test."

An undocumented feature of VB4’s Printer object requires that each newpage be initialized before the font can be changed. This code works asexpected:

 ' Start new pagePrinter.Print' Set margins as desiredPrinter.ScaleMode = vbTwipsPrinter.CurrentY = 720' Now you can set the fontPrinter.FontName = "Arial"Printer.FontSize = 11Printer.Print "This is a test."Printer.EndDoc

devx-admin

Share the Post: