This documentation is archived and is not being maintained.

PrintController.OnStartPage Method

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

[Visual Basic]
Public Overridable Function OnStartPage( _
   ByVal document As PrintDocument, _
   ByVal e As PrintPageEventArgs _
) As Graphics
[C#]
public virtual Graphics OnStartPage(
 PrintDocument document,
 PrintPageEventArgs e
);
[C++]
public: virtual Graphics* OnStartPage(
 PrintDocument* document,
 PrintPageEventArgs* e
);
[JScript]
public function OnStartPage(
   document : PrintDocument,
 e : PrintPageEventArgs
) : Graphics;

Parameters

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

Return Value

A Graphics object that represents a page from a PrintDocument.

Remarks

OnStartPage is called immediately before the PrintDocument raises the PrintPage event.

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.

Use the OnStartPage method to set how to print a page in a document. For example, you can adjust page settings separately for each page.

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 | OnStartPrint | PrintPageEventArgs

Show: