DekGenius.com
[ Team LiB ] Previous Section Next Section

PreviewPrintController

System.Drawing.Printing (system.drawing.dll)class

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 e);  // overrides PrintController
   public override void OnStartPrint(PrintDocument document, PrintEventArgs e);  // overrides PrintController
}

Hierarchy

System.Object PrintController PreviewPrintController

    [ Team LiB ] Previous Section Next Section