Introduction

The Visual C# .NET method of printing is anchored by the PrintDocument class. This class represents a connection between an application and a printer, and it abstracts all the specific printer functions into a single set of methods and properties. All the complexities and details of printing are hidden within this class. After you learn how to manage the PrintDocument class, you don't need to worry at all about the details of programming any particular printer.

The PrintDocument class raises an event for each page to be printed. You need to write code to handle this event, which supplies the actual text or graphics to be printed. If you recall the details of drawing graphics from Chapter 1, “Introducing Windows Forms,” you'll see that printing is very similar to drawing. Indeed, the classes that handle printing are contained within the System.Drawing.Printing namespace.

NOTE

Crystal Reports One thing that the exam doesn't cover is the use of Crystal Reports, the high-end reporting component that ships as a part of Visual Studio .NET. Crystal Reports is designed to allow you to put together flexible data-based reports. However, it can't handle the sort of general, low-level printing chores that I cover in this chapter.


In this chapter you'll learn about printing directly from Visual C# .NET. You'll see how to use the PrintDocument component to print both text and graphics, and you'll learn about the additional controls that give you access to the printing-related common dialog boxes that are part of Windows.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.210.166