XRPictureBox.Image Property
Bindable. Gets or sets the image to display in the XRPictureBox control.
Namespace: DevExpress.XtraReports.UI
Assembly: DevExpress.XtraReports.v17.2.dll
NuGet Package: DevExpress.Reporting.Core
Declaration
Property Value
Type | Description |
---|---|
Image | A Image object which is the image to display in the picture box. |
Remarks
Use the Image property to specify the image to display in the XRPictureBox control. When specified the image will always be saved with the report into its resources (or with the report in the .Repx file). If you want to save only the path to the image, and not the image itself, use the XRPictureBox.ImageUrl property instead.
Note
After setting the XRPictureBox.ImageUrl property’s value, the Image property will be set to null (Nothing in Visual Basic).
After setting the Image property’s value, the XRPictureBox.ImageUrl property will be set to Empty.
Note
The Image property is bindable, which means that it can be bound to a data field in a report’s data source. To learn more, see the Binding Report Controls to Data section.
Example
This example demonstrates how to create an XRPictureBox object, and set some of its properties.
using System.Drawing;
using DevExpress.XtraPrinting;
using DevExpress.XtraReports.UI;
// ...
public XRPictureBox CreateXRPictureBox()
{
// Create an XRPictureBox object.
XRPictureBox xrPictureBox = new XRPictureBox();
// Set its image.
xrPictureBox.Image = new Bitmap("C:\\test.bmp");
// Uncomment these lines to get images from a data source.
// ExpressionBinding expressionBinding = new ExpressionBinding("BeforePrint", "Image", "[Picture]");
// xrPictureBox.ExpressionBindings.Add(expressionBinding);
// Set its location.
xrPictureBox.LocationF = new PointF(150F, 25F);
// Set its size.
xrPictureBox.SizeF = new SizeF(160F, 120F);
// Set its size mode.
xrPictureBox.Sizing = ImageSizeMode.AutoSize;
return xrPictureBox;
}