BrickGraphics.DrawImage(Image, RectangleF) Method
Adds a specific ImageBrick brick to a report.
Namespace: DevExpress.XtraPrinting
Assembly: DevExpress.Printing.v21.2.Core.dll
NuGet Package: DevExpress.Printing.Core
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();