Skip to main content
A newer version of this page is available. .

XRPictureBox.ImageSource Property

Bindable. Gets or sets an image to display it in the XRPictureBox control.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v18.2.dll

Declaration

[SRCategory(ReportStringId.CatData)]
public ImageSource ImageSource { get; set; }

Property Value

Type Description
ImageSource

The image to be displayed in the picture box.

Remarks

You can assign images of the following formats using this property: BMP, JPG, JPEG, GIF, TIF, TIFF, PNG, ICO, DIB, RLE, JPE, JFIF, EMF, WMF, SVG.

When specified, the image is saved with the report in its resources (or with the report in the .repx file). If you want to save only a 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 ImageSource property is set to null (Nothing in Visual Basic).

After setting the ImageSource property’s value, the XRPictureBox.ImageUrl property is set to Empty.

You can enable image editing in Print Preview. To do this, set the EditOptions | Enabled property to true. For details, refer to the Content Editing in Print Preview topic.

Note

The ImageSource 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;
using DevExpress.XtraPrinting.Drawing;
// ...

public XRPictureBox CreateXRPictureBox()
{
    // Create an XRPictureBox object.
    XRPictureBox xrPictureBox = new XRPictureBox();

    // Set its image.
    xrPictureBox.ImageSource = new ImageSource(new Bitmap("C:\\test.bmp"));
    // Uncomment these lines to get images from a data source.
    // ExpressionBinding expressionBinding = new ExpressionBinding("BeforePrint", "ImageSource", "[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;
}
See Also