Skip to main content

GridView.AfterPrintRow Event

Fires after an individual row has been printed/exported, and allows you to add custom information to the printout/export output.

Namespace: DevExpress.XtraGrid.Views.Grid

Assembly: DevExpress.XtraGrid.v24.1.dll

NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

[DXCategory("Printing")]
public event AfterPrintRowEventHandler AfterPrintRow

Event Data

The AfterPrintRow event's data class is PrintRowEventArgs. The following properties provide information specific to this event:

Property Description
BrickGraphics Gets a BrickGraphics object that implements report drawing functions.
Graphics Gets a GDI+ grid’s drawing surface.
HasFooter Gets whether the row contains a footer.
Level Gets the group level of the printed row .
PS Gets the PrintingSystem object that provides methods to create bricks in the printout/export output.
RowHandle Gets the handle of the printed row.
X Gets or sets the X coordinate, in pixels, where the next row will be drawn in the printout/export output.
Y Gets or sets the Y coordinate, in pixels, where the next row will be drawn in the printout/export output.

Remarks

The AfterPrintRow event fires after an individual row has been printed/exported. You can handle this event to customize the printout (export output). For instance, you can insert page breaks, add custom information to the output, etc.

When adding custom information to the output, you typically draw it at the position specified by the PrintRowEventArgs.X and PrintRowEventArgs.Y properties. After drawing, you need to adjust these coordinates, so that the next row is printed/exported after it has been drawn.

To perform actions before a row is printed/exported, handle the GridView.BeforePrintRow event. See this topic for an example of customizing the print/export output. The techniques demonstrated by this example are also applicable when handling the AfterPrintRow event.

Example

This example handles the AfterPrintRow event to print group rows with footers on separate pages.

private void gridView1_AfterPrintRow(object sender, Views.Printing.PrintRowEventArgs e) {
    if(e.HasFooter)
        e.PS.InsertPageBreak(e.Y);
}

Print Groups with Footers on Separate Pages

See Also