Name
PreviewPrintController
Synopsis
This class, derived from PrintController
, manages
the printing of a document to a series of Image
objects, which can then be displayed to the user as a preview of the
final printed output.
You would typically use a
System.Windows.Forms.PrintPreviewDialog
or
System.Windows.Forms.PrintPreviewControl
, which
then uses this class in its implementation to display a series of
page images to the user.
You can enable antialiasing to improve display quality, with the
UseAntiAlias
property.
GetPreviewPageInfo()
returns an array of
PreviewPageInfo
objects, which encapsulate the
images representing each page to be printed.
To use a PreviewPrintController
independently of
the aforementioned controls, you can construct an instance and assign
it to the PrintDocument.PrintController
. If you
then call PrintDocument.Print()
, the controller
will be populated with the images, which you can then retrieve with
the GetPreviewPageInfo()
method.
public class PreviewPrintController : PrintController { // Public Constructors public PreviewPrintController(); // Public Instance Properties public virtual bool UseAntiAlias{set; get; } // Public Instance Methods public PreviewPageInfo[ ] GetPreviewPageInfo(); public override void OnEndPage(PrintDocument document, PrintPageEventArgs e); // overrides PrintController public override void OnEndPrint(PrintDocument document, PrintEventArgs e); // overrides PrintController public override Graphics OnStartPage(PrintDocument document, PrintPageEventArgs ...
Get .NET Windows Forms in a Nutshell 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.