Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Printing Overview
One of Visual Basics biggest weaknesses is its printing facilities
There are three main ways of printing
Use the PrintForm Method to print a complete form
Use a Printer Object, this is very code intensive
Use a third party application e.g Crystal Reports
Well overview each of these and look at what techniques can be
used to improve the quality of the print
PrintForm Method
The easiest to implement
Produces a complete picture of the form as displayed on the
screen
As it produces a graphics image it can be large in size and hence
slow to print
Syntax
FormName.PrintForm
e.g.
Form1.PrintForm
You can place the PrintForm method under a command buttons
click event or any other event
PrintForm Method - Usage
Sub Command1_Click ()
Command1.Visible = False
Command2.Visible = False
Form1.PrintForm
Command1.Visible = True
Command2.Visible = True
End Sub
You also need to specify the look of your font in terms of size,
style and whether bold, italics etc. It has properties similar to
controls, look them up in help
e.g.
Printer.FontSize = 12
Printer.FontUnderline = True
Printer.FontBold = True
Printer.FontItalic = True
Printer.Print This is Complex
Would print This is Complex in size 12 font, underlined, bold and
in italics
As you can see to do a good quality report it takes a lot of
planning and a lot of code
Printer Object - Font Styles