Skip to main content

BrickGraphics.EndUnionRect() Method

Indicates the completion of brick group creation.

Namespace: DevExpress.XtraPrinting

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

NuGet Package: DevExpress.Printing.Core

Declaration

public void EndUnionRect()

Remarks

A user can group several bricks together. This operation prevents clipping bricks united in a group when page margins change. After calling the EndUnionRect method, a brick group is delimited by an invisible rectangle defined by the top-left and bottom-right bricks of the group.

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