Skip to main content
A newer version of this page is available.

BrickGraphics.DrawBrick(Brick, RectangleF) Method

Adds a brick to a report.

Namespace: DevExpress.XtraPrinting

Assembly: DevExpress.Printing.v18.2.Core.dll

Declaration

public Brick DrawBrick(
    Brick brick,
    RectangleF rect
)

Parameters

Name Type Description
brick Brick

The brick to be added to a report.

rect RectangleF

A RectangleF structure that specifies the location and size of the current brick in measurement units, specified via the BrickGraphics.PageUnit property value.

Returns

Type Description
Brick

The brick added to a report.

Remarks

This method can be used to add any brick type to a report.

Note

Enclose the document creation statements into the PrintingSystemBase.Begin and PrintingSystemBase.End call pair.

Example

The following code demonstrates how to use the BrickGraphics.DrawBrick method to draw a predefined brick in a report. Note that prior to executing this code, it’s required to add the PrintingSystem component (called printingSystem1) to your application.

Tip

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E74.

using System.Drawing;
using DevExpress.XtraPrinting;
// ...

private void button1_Click(object sender, EventArgs e) {
    // Obtain the PrintingSystem's graphics.
    BrickGraphics gr = printingSystem1.Graph;

    // Load an image from a file.
    Image img = Image.FromFile(@"..\..\Data\Fish.png");

    // Create an ImageBrick and specify its properties.
    ImageBrick ibrk = new ImageBrick();
    ibrk.Image = img;
    ibrk.Sides = BorderSide.All;
    ibrk.BorderColor = Color.Blue;
    ibrk.BorderWidth = 10;

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

    // Add the ImageBrick to the Detail section of the report.
    RectangleF r = new RectangleF(new PointF(0, 0), new SizeF(256, 160));
    gr.Modifier = BrickModifier.Detail;
    gr.DrawBrick(ibrk, r);

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

    // Display the Print Preview form.
    printingSystem1.PreviewFormEx.Show();
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the DrawBrick(Brick, RectangleF) 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.

See Also