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

BrickGraphics.DrawImage(Image, RectangleF, BorderSide, Color) Method

Adds a specific ImageBrick brick to a report.

Namespace: DevExpress.XtraPrinting

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

Declaration

public ImageBrick DrawImage(
    Image image,
    RectangleF rect,
    BorderSide sides,
    Color backColor
)

Parameters

Name Type Description
image Image

The image to draw within a specifc brick.

rect RectangleF

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

sides BorderSide

Border settings for a specific ImageBrick.

backColor Color

The color to be displayed in the transparent image.

Returns

Type Description
ImageBrick

The ImageBrick added to a report.

Remarks

This method adds a specific ImageBrick to a report. The brick’s position is defined via the rect parameter. This parameter also defines brick size. If the rectanlge’s dimensions and actual brick image dimensions are different, the image is stretched or shrunk to fit inside the specified rectangle. To prevent this, the rect dimensions must exactly match the image dimensions. If an image has transparent areas, then these areas are filled with the color specified via the backColor parameter value. If the backColor parameter value is set to Color.Empty, the color used to fill the transparent areas is defined via the BrickGraphics.BackColor property value. Graphical settings which are not defined via these method parameters are obtained from the corresponding BrickGraphics properties.

Example

This example demonstrates how to create an ImageBrick using the BrickGraphics.DrawImage method.

DrawImage

using DevExpress.XtraPrinting;
// ...

    VisualBrick visBrick;
    Image img = imageList1.Images[0];   
    BrickGraphics brickGraph = printingSystem1.Graph;

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

    // Create a rectangle.
    RectangleF rect = new RectangleF(new PointF(0, 0), new SizeF(96, 96));

    // Specify a page area.
    brickGraph.Modifier = BrickModifier.Detail;

    // Add an image brick to the report.
    visBrick = brickGraph.DrawImage(img, rect, BorderSide.All, Color.White);

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

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

The following code snippets (auto-collected from DevExpress Examples) contain references to the DrawImage(Image, RectangleF, BorderSide, Color) 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