Bewerken

Share via


PrintControllerWithStatusDialog.OnStartPrint Method

Definition

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

public:
 override void OnStartPrint(System::Drawing::Printing::PrintDocument ^ document, System::Drawing::Printing::PrintEventArgs ^ e);
public override void OnStartPrint (System.Drawing.Printing.PrintDocument document, System.Drawing.Printing.PrintEventArgs e);
override this.OnStartPrint : System.Drawing.Printing.PrintDocument * System.Drawing.Printing.PrintEventArgs -> unit
Public Overrides Sub OnStartPrint (document As PrintDocument, e As PrintEventArgs)

Parameters

document
PrintDocument

A PrintDocument that represents the document currently being printed.

e
PrintEventArgs

A PrintEventArgs that contains the event data.

Remarks

The PrintControllerWithStatusDialog class calls the PrintController.OnStartPrint method on the encapsulated PrintController.

The OnStartPrint method is called immediately after the PrintDocument raises the BeginPrint event.

Use OnStartPrint 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. OnStartPrint creates the Graphics object that is sent to the printer. After OnStartPrint is called, the OnStartPage method sets the Graphics object to a graphic of a single page. The OnEndPage method clears the Graphics object, while the OnEndPrint method deallocates the object.

OnStartPrint is a good place to verify that PrinterSettings are valid.

Applies to