PrintDocument.OnEndPrint(PrintEventArgs) PrintDocument.OnEndPrint(PrintEventArgs) PrintDocument.OnEndPrint(PrintEventArgs) PrintDocument.OnEndPrint(PrintEventArgs) Method


引发 EndPrint 事件。Raises the EndPrint event. 该事件在文档的最后一页打印完后被调用。It is called when the last page of the document has printed.

 virtual void OnEndPrint(System::Drawing::Printing::PrintEventArgs ^ e);
protected virtual void OnEndPrint (System.Drawing.Printing.PrintEventArgs e);
abstract member OnEndPrint : System.Drawing.Printing.PrintEventArgs -> unit
override this.OnEndPrint : System.Drawing.Printing.PrintEventArgs -> unit
Protected Overridable Sub OnEndPrint (e As PrintEventArgs)


PrintEventArgs PrintEventArgs PrintEventArgs PrintEventArgs

包含事件数据的 PrintEventArgsA PrintEventArgs that contains the event data.


OnEndPrint方法允许派生类在不附加委托的情况下处理事件。The OnEndPrint 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. 如果打印进程被取消或在打印过程中发生异常,也会调用方法。OnEndPrintThe OnEndPrint method is also called if the printing process is canceled or an exception occurs during the printing process.

当派生类调用OnEndPrint方法时,它通过委托调用事件处理程序来EndPrint引发事件。When a derived class calls the OnEndPrint method, it raises the EndPrint event by invoking the event handler through a delegate. 有关详细信息, 请参阅处理和引发事件For more information, see Handling and Raising Events.


在派生类中重写 OnEndPrint(PrintEventArgs) 时,一定要调用基类的 OnEndPrint(PrintEventArgs) 方法,以便已注册的委托对事件进行接收。When overriding OnEndPrint(PrintEventArgs) in a derived class, be sure to call the base class's OnEndPrint(PrintEventArgs) method so that registered delegates receive the event. 此方法是取消初始化的好地方。This method is a good place for uninitialization.