Page.AddBrick(VisualBrick) Method
Adds the specified brick to the page.
Namespace: DevExpress.XtraPrinting
Assembly: DevExpress.Printing.v24.2.Core.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
brick | VisualBrick | The brick to be added to the page. |
Remarks
Use this method to add a brick to a document’s page(s). The following code demonstrates how to use this method in the report’s AfterPrint event handler to add a label brick to all pages of a document:
using System;
using System.Drawing;
using DevExpress.XtraPrinting;
using DevExpress.Drawing;
namespace T457705 {
public partial class XtraReport1 : DevExpress.XtraReports.UI.XtraReport {
public XtraReport1() {
InitializeComponent();
}
private void XtraReport1_AfterPrint(object sender, EventArgs e) {
string text = "Developer Express Inc.";
DXFont font = new DXFont("Arial", 20f);
SizeF size = this.PrintingSystem.Graph.MeasureString(text, font);
size.Height = size.Height + 100;
size.Width = size.Width + 50;
foreach (Page page in this.Pages) {
LabelBrick labelBrick = CreateLabel(page, font, size, text);
page.AddBrick(labelBrick);
}
}
LabelBrick CreateLabel(Page page, DXFont font, SizeF size, string text) {
LabelBrick labelBrick = new LabelBrick() {
Angle = 90,
Font = font,
Text = text,
VertAlignment = DevExpress.Utils.VertAlignment.Center
};
PointF brickLocation = new PointF(page.MarginsF.Left / 5, page.Size.Height / 2);
SizeF brickSize = new SizeF(size.Height, size.Width);
labelBrick.Initialize(this.PrintingSystem, new RectangleF(brickLocation, brickSize));
return labelBrick;
}
}
}
The brick is printed over other bricks if they occupy its position.
Note
This method does not work if you use the CachedReportSource/CachedReportSourceWeb component to create report documents.
Tip
Review the Add Cross-Band Data help topic for information on how to print content behind report bands.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AddBrick(VisualBrick) method.
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.