Namespace:DevExpress.XtraReports.UI
Assembly:DevExpress.XtraReports.v18.2.dll

Syntax
C# |
public class PrintOnPageEventArgs : PrintEventArgs
|
VB |
Public Class PrintOnPageEventArgs Inherits PrintEventArgs
|

Remarks
The XRControl.PrintOnPage event occurs when the representation of a control is printed on the current page of the report. A PrintOnPageEventArgs specifies the PageIndex of the current page.

Example
The following example demonstrates how to use the XRControl.PrintOnPage event. The event handler below checks if an xrLabel1 is being printed on the last page (in case the PageCount property is equal to PageIndex minus 1), and, if yes, sets its text to "The last page!". Otherwise, it checks if a label is being printed on the odd page, and, if yes, it cancels its printing.
C# |
using DevExpress.XtraReports.UI;
private void xrLabel1_PrintOnPage(object sender, PrintOnPageEventArgs e) {
if (e.PageIndex == e.PageCount-1)
((XRLabel)sender).Text = "The last page!";
else
if (e.PageIndex % 2 == 0)
e.Cancel = true;
}
|
VB |
Imports DevExpress.XtraReports.UI
Private Sub OnLabelPrintOnPage(ByVal sender As Object, ByVal e As PrintOnPageEventArgs) _
Handles xrLabel1.PrintOnPage
If e.PageIndex = e.PageCount - 1 Then
CType(sender, XRLabel).Text = "The last page!"
Else
If e.PageIndex Mod 2 = 0 Then
e.Cancel = True
End If
End If
End Sub
|

Inheritance Hierarchy
System.Object
System.EventArgs
System.ComponentModel.CancelEventArgs
System.Drawing.Printing.PrintEventArgs
PrintOnPageEventArgs

See Also