System.Drawing.Printing.PreviewPrintController.OnStartPage Method

Begins the control sequence that determines when and how to preview a page in a print document.

Syntax

public override System.Drawing.Graphics OnStartPage (PrintDocument document, PrintPageEventArgs e)

Parameters

document
A System.Drawing.Printing.PrintDocument that represents the document being previewed.
e
A System.Drawing.Printing.PrintPageEventArgs that contains data about how to preview a page in the print document. Initially, the PrintPageEventArgs.Graphics property of this parameter will be null. The value returned from this method will be used to set this property.

Returns

A System.Drawing.Graphics that represents a page from a System.Drawing.Printing.PrintDocument.

Remarks

PreviewPrintController.OnStartPage(PrintDocument, PrintPageEventArgs) is called immediately before System.Drawing.Printing.PrintDocument raises the PrintDocument.PrintPage event.

PreviewPrintController.OnStartPrint(PrintDocument, PrintEventArgs) creates the System.Drawing.Graphics that is displayed during the print preview. After PreviewPrintController.OnStartPrint(PrintDocument, PrintEventArgs) is called, the PreviewPrintController.OnStartPage(PrintDocument, PrintPageEventArgs) method sets the System.Drawing.Graphics to a graphic of a single page. The PreviewPrintController.OnEndPage(PrintDocument, PrintPageEventArgs) method clears the System.Drawing.Graphics, while the PreviewPrintController.OnEndPrint(PrintDocument, PrintEventArgs) method deallocates the object.

Note:

Anti-aliasing, also known as gray scaling, makes the print preview look better. However, the use of anti-aliasing can slow down the rendering speed. For more information about anti-aliasing, see the PreviewPrintController.UseAntiAlias property.

Requirements

Namespace: System.Drawing.Printing
Assembly: System.Drawing (in System.Drawing.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0