Skip to main content

How to: Create a Non-Printable Brick

  • 3 minutes to read

This topic illustrates how to create a brick that is visible on the screen, but not printed.

All bricks created by the XtraPrinting Library can be printed. Occasionally you have to create bricks used for navigation purposes only. Although these bricks are displayed on screen, they should be excluded from the printout. This can be easily accomplished via the BrickBase.CanPublish property.


The BrickBase.CanPublish property has no effect on export to different formats.

The following code sample illustrates the implementation of a non-printable brick. The preview of the resulting report is shown in the picture.


using DevExpress.XtraPrinting;
// ...

BrickGraphics graph = printingSystem1.Graph;

// Start the report generation.

// Set the modifier - specify the page area.
graph.Modifier = BrickModifier.MarginalHeader;

string format = "Page {0} of {1}";
graph.Font = graph.DefaultFont;
graph.BackColor = Color.Transparent;
RectangleF r = new RectangleF(0, 0, 0, graph.Font.Height);

// Create a brick.
PageInfoBrick brick = graph.DrawPageInfo(PageInfo.NumberOfTotal, format, 
    Color.Black, r, BorderSide.None);
brick.Alignment = BrickAlignment.Far;
brick.AutoWidth = true;

// Create another brick with different alignment.
brick = graph.DrawPageInfo(PageInfo.DateTime, "{0:MMMM dd}", Color.Black, r, 

// Change the page area - set the modifier.
printingSystem1.Graph.Modifier = BrickModifier.DetailHeader;

graph.BackColor = Color.Silver;

// Create a brick, which will be hidden in the printout.
TextBrick tBrick = new TextBrick(BorderSide.None, 1, Color.Black, Color.Khaki, 
tBrick.Url = "";
tBrick.Text = "Click here to visit our web site";
tBrick.Printed = false;
printingSystem1.Graph.DrawBrick(tBrick, new RectangleF(0, 0, 200, 20));

// Create a brick - a column header.
printingSystem1.Graph.DrawString("Report Items", Color.Black, 
    new RectangleF(0, 20, 200, 20), BorderSide.All);

// Change the page area - set the modifier.
printingSystem1.Graph.Modifier = BrickModifier.Detail;

graph.BackColor = Color.White;

// Create bricks.
for (int i = 0; i < 100; i++)
    printingSystem1.Graph.DrawString("Item N" + Convert.ToString(i + 1), 
        Color.Black, new RectangleF(0, 20 * i, 200, 20), BorderSide.All);

// Finish the report generation.

// Preview the report.

Now we have a non-printable brick which is used for navigation, and is not printed out.


A complete sample project is available in the DevExpress Code Examples database at

See Also