Chapter 17

Printing and Threading

What you will learn in this chapter:

  • How to initialize a printer object
  • How to alter things such as fonts, page size, and margins
  • How to create a printer class that can be used in other programs
  • What threading is and how to use it with your printer class
  • What reflection is

wrox.com code downloads for this chapter

You can find the wrox.com code downloads for this chapter at www.wrox.com/remtitle.cgi?isbn=9781118336922 on the Download Code tab. The code in the Chapter17 folder is individually named according to the names throughout the chapter.

In this chapter you learn about using your printer and the resources associated with it. Some of the topics learned here can be retrofitted to previous programs. For example, threading might be useful in the database programs where there is a noticeable pause while network information is updated.

Using a Printer

Often a program generates data that you don't necessarily want to persist on disk, but that you might like to review at a later time without rerunning the program. Obviously, printed output of the data is one way to go. In this chapter, you examine some of the printer objects that should prove useful in your programs.

In the following Try It Out you write a program that can read and print a simple text file. Although a text file is used for the output to print, the methods used apply to almost any type of data.

Try It Out: Printing (Chapter17ProgramBasicPrint.zip)
In this Try It Out, you write ...

Get Beginning Object-Oriented Programming with C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.