A newer version of this page is available. Switch to the current version.

BrickGraphics.DrawImage(Image, RectangleF) 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
)
Public Function DrawImage(
    image As Image,
    rect As RectangleF
) As ImageBrick

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.

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. Graphical settings which are not defined via this method are obtained from the corresponding BrickGraphics properties.

Examples

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