Skip to main content

BrickGraphics.BeginUnionRect() Method

Must be called before the creation of a brick group.

Namespace: DevExpress.XtraPrinting

Assembly: DevExpress.Printing.v24.1.Core.dll

NuGet Package: DevExpress.Printing.Core

Declaration

public void BeginUnionRect()

Remarks

A user can group several bricks. This operation prevents clipping of bricks combined in a group when page margins change. After calling the BeginUnionRect method, all bricks added to a report are combined into the group. Brick grouping ends after calling the BrickGraphics.EndUnionRect method.

Example

The following code demonstrates how to create a non-separable group of bricks using the BeginUnionRect and the EndUnionRect methods. The result is shown in the picture below.

Note

These bricks are kept together if the page size allows this; otherwise the group is split as usual.

BeginEndUnionRect

using DevExpress.XtraPrinting;
// ...

    BrickGraphics brickGraph = printingSystem1.Graph;
    int top = 0;

    // Start the report generation.
    printingSystem1.Begin();

    // Specify a page area.
    brickGraph.Modifier = BrickModifier.Detail;
    // Start drawing a brick group.
    brickGraph.BeginUnionRect();

    // Specify formatting.
    brickGraph.StringFormat = new BrickStringFormat(StringAlignment.Center, 
        StringAlignment.Center);
    brickGraph.BackColor = Color.Khaki;
    brickGraph.BorderColor = Color.MidnightBlue;
    brickGraph.Font = new DXFont("Tahoma", 14, DXFontStyle.Bold | DXFontStyle.Italic);

    // Draw bricks.
    brickGraph.DrawString("DevExpress", Color.MidnightBlue,
        new RectangleF(0, 0, 150, 50), BorderSide.All);
    brickGraph.DrawString("100% Native", Color.MidnightBlue,
        new RectangleF(0, top += 50, 150, 50), BorderSide.All);
    brickGraph.DrawString(".NET Tecnologies", Color.MidnightBlue,
        new RectangleF(0, top += 50, 150, 50), BorderSide.All);

    // Finish drawing a brick group.
    brickGraph.EndUnionRect();

    // Finish the report generation.
    printingSystem1.End();

    // Preview the report.
    printingSystem1.PreviewFormEx.Show();
See Also