System.Drawing.Printing.PrintController.OnStartPrint Method

When overridden in a derived class, begins the control sequence that determines when and how to print a document.

Syntax

public virtual void OnStartPrint (PrintDocument document, PrintEventArgs e)

Parameters

document
A System.Drawing.Printing.PrintDocument that represents the document currently being printed.
e
A System.Drawing.Printing.PrintEventArgs that contains the event data.

Remarks

PrintController.OnStartPrint(PrintDocument, PrintEventArgs) is called immediately after the System.Drawing.Printing.PrintDocument raises the PrintDocument.BeginPrint event.

Use the PrintController.OnStartPrint(PrintDocument, PrintEventArgs) method to determine when and how to print a document. For example, you can delay printing for 30 minutes or adjust the printer settings for the document. PrintController.OnStartPrint(PrintDocument, PrintEventArgs) creates the System.Drawing.Graphics that is sent to the printer. After PrintController.OnStartPrint(PrintDocument, PrintEventArgs) is called, the PrintController.OnStartPage(PrintDocument, PrintPageEventArgs) method sets the System.Drawing.Graphics to one of a single page. The PrintController.OnEndPage(PrintDocument, PrintPageEventArgs) method clears the System.Drawing.Graphics, while the PrintController.OnEndPrint(PrintDocument, PrintEventArgs) method deallocates the object.

The PrintController.OnStartPrint(PrintDocument, PrintEventArgs) method is a good place to verify that System.Drawing.Printing.PrinterSettings are valid.

Requirements

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