BrickGraphics.DrawBrick(Brick, RectangleF) Method

Adds a brick to a report.

Namespace: DevExpress.XtraPrinting

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

Declaration

public Brick DrawBrick(
    Brick brick,
    RectangleF rect
)
Public Function DrawBrick(
    brick As Brick,
    rect As RectangleF
) As Brick

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.

Examples

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();
}
See Also