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

Adds a specific PageImageBrick to a report.

Namespace: DevExpress.XtraPrinting

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

Declaration

public PageImageBrick DrawPageImage(
    Image image,
    RectangleF rect,
    BorderSide sides,
    Color backColor
)
Public Function DrawPageImage(
    image As Image,
    rect As RectangleF,
    sides As BorderSide,
    backColor As Color
) As PageImageBrick

Parameters

Name Type Description
image Image

The image to draw in a specific 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 PageImageBrick.

backColor Color

The color to be displayed in the transparent portions of an image.

Returns

Type Description
PageImageBrick

The PageImageBrick added to a report.

Remarks

This method adds a specific PageImageBrick. The brick's position in a report is defined via the rect parameter. This parameter also determines the size of the image displayed within a brick. If the dimensions of the specified rectanlge 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 the image has transparent areas, then these areas are filled with the color specified via backColor. If backColor is set to Color.Empty, the color used to fill transparent areas is defined via the BrickGraphics.BackColor property value.

Examples

This example demonstrates how to create a PageImageBrick using the BrickGraphics.DrawPageImage method.

DrawPageImage

using DevExpress.XtraPrinting;
// ...

    PageImageBrick pimBrick;
    Image img = imageList2.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(179, 34));

    // Specify a marginal page header area.
    brickGraph.Modifier = BrickModifier.MarginalHeader;

    // Create a page image brick.
    pimBrick = brickGraph.DrawPageImage(img, rect, BorderSide.None, Color.White);

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

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