O'Reilly logo

Microsoft® Visual Basic® .NET Programmer's Cookbook by Matthew MacDonald

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

Display a Dynamic Print Preview

Problem

You want to use an on-screen preview that shows how a printed document will look.

Solution

Use the PrintPreviewControl or PrintPreviewDialog.

Discussion

As described earlier, the code used to print a document to a page is almost identical to the code used to draw graphics on a window. This makes it possible for you to create code that can print or draw a print preview with equal ease. However, you don’t need to go to this extra step because .NET already provides a control that can take a print document, run your printing code, and use it to generate a graphical on-screen preview. In fact, .NET provides two such controls: PrintPreviewDialog, which shows a preview in a standalone window, and PrintPreviewControl ...

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