PrintDocument


The PrintDocument component represents an object that will be printed. Your program can use this object to send output to a printer.

The general procedure for printing using this object is to create the object, set its properties to determine how the printout is generated (the printer’s name, paper tray, and so forth), and then call the object’s Print method.

When the object needs to generate a page of output, it raises its PrintPage event. Your code catches that event, draws the page, and then sets the event handler’s e.HasMorePages value to indicate whether that was the last page of output. See the previous section, “PrintDialog,” for a small example.

The PrintDocument object provides only a few important properties itself. You set most of the values that describe the printing operation using the PrinterSettings object referenced by the component’s Printer?Settings property. See the previous section, “PrintDialog,” for information on the Printer?Settings object.

In addition to its PrinterSettings property, the PrintDocument object provides a DocumentName property that determines the name displayed for the document in printing-related dialog boxes such as the printer queue display.

This component also provides an OriginAtMargins property that determines whether each page’s graphical origin begins at the page’s margins. Setting OriginAtMargins to True makes it easier to draw relative to the left and top margins, rather than the upper-left corner of the physical page.




Visual Basic 2005 with  .NET 3.0 Programmer's Reference
Visual Basic 2005 with .NET 3.0 Programmer's Reference
ISBN: 470137053
EAN: N/A
Year: 2007
Pages: 417

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net