StandardPrintController.OnStartPrint Method
Begins the control sequence that determines when and how to print a document.
[Visual Basic] Overrides Public Sub OnStartPrint( _ ByVal document As PrintDocument, _ ByVal e As PrintEventArgs _ ) [C#] public override void OnStartPrint( PrintDocument document, PrintEventArgs e ); [C++] public: void OnStartPrint( PrintDocument* document, PrintEventArgs* e ); [JScript] public override function OnStartPrint( document : PrintDocument, e : PrintEventArgs );
Parameters
- document
- A PrintDocument that represents the document being printed.
- e
- A PrintEventArgs that contains data about how to print the document.
Exceptions
| Exception Type | Condition |
|---|---|
| InvalidPrinterException | The printer settings are not valid. |
| Win32Exception | The native Win32 Application Programming Interface (API) could not start a print job. |
Remarks
OnStartPrint is called immediately after PrintDocument raises the BeginPrint event.
OnStartPrint creates the Graphics object used in printing. 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 verifies that the printer settings are valid.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also
StandardPrintController Class | StandardPrintController Members | System.Drawing.Printing Namespace | OnEndPage | OnEndPrint | OnStartPage | PrinterSettings | PrintEventArgs