Chapter Summary

■ The PrintDocument component is the primary component involved in printing and represents a printed page. Data is sent to the printer by handling the Print-Document.PrintPages event. Methods that handle this event receive a PrintPage-EventArgs object that contains a variety of properties useful in printing, including the Graphics object that represents the printer. Text is drawn to the printer by using the Graphics.DrawString method, and graphics are drawn to the printer by using the various graphics-drawing methods of the Graphics class. Multiple pages are printed by setting the HasMorePages property of the PrintEventArgs object to True.

■ There are several dialog box components that you can use to assist the user with printing tasks. The PrintDialog component allows users to control print options and add new printers. The PageSetupDialog component allows the user to set options for the pages and paper. The PrintPreviewDialog component allows the user to view a representation of the printed document before it is actually printed.

■ You can create a customized print preview form by using the PrintPreviewControl. The PrintPreviewControl displays a preview of the document indicated by its Document property and includes properties that control the look and feel of the preview, such as Columns, Rows, UseAntiAlias, Zoom, AutoZoom, and StartPage. If needed, you can add additional methods and events to the PrintPreviewControl class by creating a derived class.

Was this article helpful?

0 0

Post a comment