10.17. Show a Dynamic Print Preview
Problem
You need to use an onscreen preview that shows how a printed document will look.
Solution
Use PrintPreviewDialog or PrintPreviewControl (both of which are found in the System.Windows.Forms namespace).
How It Works
The .NET Framework provides two elements of user interface that can take a PrintDocument instance, run your printing code (such as the code demonstrated in recipe 10-15), and use it to generate a graphical onscreen preview:
The PrintPreviewDialog, which shows a preview in a stand-alone form
The PrintPreviewControl, which shows a preview in a control that can be embedded in one of your own custom forms
To use a stand-alone print preview form, create a PrintPreviewDialog object, assign its ...
Get Visual Basic 2008 Recipes: A Problem-Solution Approach 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.