O'Reilly logo

Developing and Implementing Windows®-Based Applications with Visual C#™ .NET and Visual Studio® .NET Exam Cram™ 2 (Exam 70-316) by Priti Kalani, Amit Kalani, Kalani Kirk Hausman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The PrintDocument Component

The .NET Framework makes use of the System.Drawing. Printing.PrintDocument class for printing output. You can print anything you can draw using the PrintDocument class. Printing in .NET applications is very similar to drawing text and graphics using the classes in the System.Drawing and its child namespaces. You learned about drawing graphical interface elements in Chapter 1, “Introducing Windows Forms.”

To implement printing, you need to create a new instance of the PrintDocument class, set its properties and then call its Print method, which fires the PrintDocument.PrintPage event. You can retrieve a Graphics object from the PrintPage event and treat it as the page from which data can be printed. Using methods of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required