XRControl.AfterPrint Event
Occurs after an XRControl object is displayed in the report.
Namespace: DevExpress.XtraReports.UI
Assembly: DevExpress.XtraReports.v24.2.dll
NuGet Package: DevExpress.Reporting.Core
Declaration
Event Data
The AfterPrint event's data class is EventArgs.
Remarks
You can handle the following events to access and customize a report control:
- XRControl.BeforePrint
- AfterPrint
- XRControl.PrintOnPage
The AfterPrint event is raised when a control is already printed on a particular page in a report.
The following code snippet demonstrates how to use the AfterPrint event to extend a report with another report’s pages.
using DevExpress.XtraPrinting;
using DevExpress.XtraReports.UI;
using System;
using System.Drawing;
// ...
XtraReport CreateReport() {
XtraReport1 report1 = new XtraReport1();
report1.AfterPrint += Report1_AfterPrint;
return report1;
}
void Report1_AfterPrint(object sender, EventArgs e) {
XtraReport2 report2 = new XtraReport2();
report2.CreateDocument();
XtraReport report1 = (XtraReport)sender;
report1.ModifyDocument(x => x.AddPages(report2.Pages));
}
You can also handle a report’s AfterPrint event. The following code snippet demonstrates how to use the AfterPrint event to add a brick to a report’s page.
using DevExpress.XtraPrinting;
using DevExpress.XtraReports.UI;
using System;
using System.Drawing;
// ...
XtraReport CreateReport() {
XtraReport report = new XtraReport();
report.AfterPrint += Report_AfterPrint;
return report;
}
void Report_AfterPrint(object sender, EventArgs e) {
XtraReport report = (XtraReport)sender;
report.Pages[0].AddBrick(CreateVerticalLabel());
}
LabelBrick CreateVerticalLabel() {
LabelBrick labelBrick = new LabelBrick() {
Angle = 90,
Text = "This is a label with vertical text",
Location = new PointF(100, 300),
Size = new SizeF(100, 2700),
};
return labelBrick;
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AfterPrint event.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.