This documentation is archived and is not being maintained.

PrintController.OnStartPrint Method

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

[Visual Basic]
Public Overridable Sub OnStartPrint( _
   ByVal document As PrintDocument, _
   ByVal e As PrintEventArgs _
)
[C#]
public virtual void OnStartPrint(
 PrintDocument document,
 PrintEventArgs e
);
[C++]
public: virtual void OnStartPrint(
 PrintDocument* document,
 PrintEventArgs* e
);
[JScript]
public function OnStartPrint(
   document : PrintDocument,
 e : PrintEventArgs
);

Parameters

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

Remarks

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

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

The OnStartPrint method is a good place to verify that PrinterSettings 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

PrintController Class | PrintController Members | System.Drawing.Printing Namespace | OnEndPage | OnEndPrint | OnStartPage | PrinterSettings | PrintEventArgs

Show: