XtraReport.FillEmptySpace Event
Fires after page rendering if a gap remains between the rendered bands.
Namespace: DevExpress.XtraReports.UI
Assembly: DevExpress.XtraReports.v24.1.dll
NuGet Package: DevExpress.Reporting.Core
Declaration
Event Data
The FillEmptySpace event's data class is BandEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Band | Gets a band, for which an event has occurred. |
Remarks
Handle this event to get rid of the empty space on each page by filling it with the desired color or text, or by drawing special symbols.
Use the DetailBand.FillEmptySpace instead of this event to fill the empty space between the DetailBand and the next band/page bottom.
Example
The following code draws a Z mark that fills the blank area across a report page, by handing the XtraReport.FillEmptySpace
event.
using System.Drawing;
using DevExpress.XtraPrinting;
using DevExpress.XtraPrinting.Drawing;
using DevExpress.XtraReports.UI;
// ...
private void XtraReport1_FillEmptySpace(object sender, BandEventArgs e) {
if(!drawZBelowTheTable) {
FillEmptySpace -= report_FillEmptySpace;
return;
}
int bandHeight = GraphicsUnitConverter.Convert(e.Band.Height, ReportUnit.ToDpi(), ReportUnit.HundredthsOfAnInch.ToDpi());
if(bandHeight <= 30)
return;
// Obtain the empty space dimensions.
Size size = new Size(612, bandHeight - 30);
Size sizeInPixels = XRConvert.Convert(size, GraphicsDpi.HundredthsOfAnInch, GraphicsDpi.Pixel);
// Draw a Z-mark bitmap.
Bitmap zBitmap = new Bitmap(sizeInPixels.Width, sizeInPixels.Height);
Graphics gr = Graphics.FromImage(zBitmap);
using(Pen pen = new Pen(Color.FromArgb(205, 205, 205), 4)) {
Point[] points = new Point[] {
new Point(0, 4),
new Point(sizeInPixels.Width, 4),
new Point(0, sizeInPixels.Height - 4),
new Point(sizeInPixels.Width, sizeInPixels.Height - 4)
};
gr.DrawLines(pen, points);
}
// Create a picture control, place it within the report
// and assign the bitmap to the control.
XRPictureBox pictureBox = new XRPictureBox();
pictureBox.BackColor = Color.Transparent;
pictureBox.Size = size;
pictureBox.Location = new Point(19, 15);
pictureBox.ImageSource = new ImageSource(zBitmap);
e.Band.Controls.Add(pictureBox);
}