11.6. Printing Text
So far we have printed simple text and graphics items from the program itself. How about reading a text file and printing it from our program? Do you remember the GDI+ editor from Chapter 5? We can make the editor open a text file and add print functionality to print the text file. In this section we will read a text file and print it.
As usual, we create a Windows application and add a reference to the System.Drawing.Printing namespace. We then add a text box and four buttons to the form. We also change the Name and Text properties of the button controls. The final form looks like Figure 11.12. As you might guess, the Browse Text File button allows us to browse for text files.
Figure 11.12. The form with text file printing ...
Get Graphics Programming with GDI+ 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.