Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
OnPrintPage Method

PrintDocument.OnPrintPage Method

Raises the PrintPage event. It is called before a page prints.

[Visual Basic]
Protected Overridable Sub OnPrintPage( _
   ByVal e As PrintPageEventArgs _
protected virtual void OnPrintPage(
 PrintPageEventArgs e
protected: virtual void OnPrintPage(
 PrintPageEventArgs* e
protected function OnPrintPage(
   e : PrintPageEventArgs


A PrintPageEventArgs that contains the event data.


The OnPrintPage method allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

When a derived class calls the OnPrintPage method, it raises the PrintPage event by invoking the event handler through a delegate. For more information, see Raising an Event.

Notes to Inheritors:  When overriding OnPrintPage in a derived class, be sure to call the base class's OnPrintPage method so that registered delegates receive the event.


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

PrintDocument Class | PrintDocument Members | System.Drawing.Printing Namespace | PrintPage | PrintPageEventArgs

© 2015 Microsoft