O'Reilly logo

MCAD/MCSD.NET Training Guide (Exam 70-316): Developing and Implementing Windows®-Based Applications with Microsoft® Visual C#™ .NET and Microsoft® Visual Studio® .NET by MCSD Amit Kalani - MCAD

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

Using the PrintDocument Component

Implement print capability.

Printing in the .NET Framework is managed by the PrintDocument class. Typically, you create a new instance of the PrintDocument class, set its properties, and call its Print() method. Calling the method causes the PrintDocument.PrintPage event to occur. You determine what will be printed by adding a handler for this event. In the PrintPage event, you can retrieve and manipulate a Graphics object that lets you treat the next page to be printed as a canvas to draw on. By using the methods of the Graphics class, as well as associated objects (such as the Font or Brush objects), you can determine what to print.

The following sections explain how you can use this printing scheme to print ...

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