April 2008
Intermediate to advanced
704 pages
17h 49m
English
Problem
You need to print text or images.
Solution
Create a PrintDocument, and write a handler for the PrintDocument.PrintPage event that uses the DrawString and DrawImage methods of the Graphics class to print data to the page.
How It Works
The .NET Framework uses an asynchronous event-based printing model. To print a document, you create a System.Drawing.Printing.PrintDocument instance, configure its properties, and then call its Print method, which schedules the print job. The common language runtime (CLR) will then fire the BeginPrint, PrintPage, and EndPrint events of the PrintDocument class on a new thread. You handle these events and use the provided System.Drawing.Graphics object to output data to the page. ...
Read now
Unlock full access