BrickGraphics.DrawImage(Image, RectangleF) Method
Adds a specific ImageBrick brick to a report.
Namespace: DevExpress.XtraPrinting
Assembly: DevExpress.Printing.v22.2.Core.dll
NuGet Packages: DevExpress.Printing.Core, DevExpress.Win.Dashboard.Design
Declaration
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.
Example
This example demonstrates how to create an ImageBrick using the BrickGraphics.DrawImage method.
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();
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the DrawImage(Image, 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.