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

XRPictureBox Class

A Picture Box control that is used to display an image in a report.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v19.1.dll


public class XRPictureBox :


You can use the XRPictureBox control to embed static (stored with the report definition) or dynamic (obtained from a data source) images into a report. The images can have one of the following formats: BMP, JPG, JPEG, GIF, TIF, TIFF, PNG, ICO, DIB, RLE, JPE, JFIF, EMF, WMF, SVG.

To add the PictureBox control to a report, drag the XRPictureBox item from the DX:19.1: Report Controls Toolbox tab and drop it onto the report.


Specify the following properties to set an image:



After the ImageUrl property is specified, the ImageSource property is set to null (Nothing in Visual Basic).

After the ImageSource property is specified, the ImageUrl property is set to Empty.

Bind a Picture Box to Data

Use one of the following techniques to add the XRPictureBox control that obtains an image from a data source.

  • Invoke the control’s smart tag, expand the Expression drop-down list for the ImageSource property and select a data field.


    You can bind the ImageUrl property to data in a similar way. In this instance, the URL that specifies the image location is obtained from the data source.

    Click the Expression option’s ellipsis button to invoke the Expression Editor. Use this editor to construct a binding expression that can include two or more data fields.

  • Drag an image data field from the report’s Field List and drop it onto a report band.

  • Right-click a data field in the Field List and drop it onto a report band. Select the PictureBox item in the invoked context menu.

    DesignTimeFeatures - FieldList4.png

  • See the Bind Report Controls to Data topic for more information on the available data binding modes and how to create data-aware controls.

You can bind the XRPictureBox control to the following image types:

  • Image
  • DevExpress.Utils.Svg.SvgImage
  • XML-formatted SVG
  • Byte Array received from an SVG string or an Image

SVG Support Limitations

The XRPictureBox control does not support the following SVG content:

  • Gradient colors
  • Text (you can convert text to curves as a workaround)
  • Animations
  • External .css styles

Export (except for PDF) has the following limitations:

  • SVG images are converted to metafiles because document viewers may not support SVG format.

  • SVG images are exported as PNG in the Microsoft Azure environment.

The Medium Trust permission level does not support SVG.

Image Size Modes

Set the XRPictureBox.Sizing property to one of the available image size modes to specify how to position an image within the control.





The image is displayed with its original dimensions.



The image is stretched to fill both the control’s width and height.



The control’s dimensions are auto-adjusted to the image size.



The image is proportionally resized, so that it fits the control.



If the control’s dimensions exceed the image size, the image is centered and shown full-size.

Otherwise, the image is resized to fit into the control’s dimensions.



The original image is replicated within the picture control starting from the upper-left corner.

The replicated image is clipped if it does not fit in the picture control which contains it.

To display the image in the middle of the control, set the XRPictureBox.Sizing property to ImageSizeMode.Normal and the XRPictureBox.ImageAlignment property to ImageAlignment.MiddleCenter.


You can add a possibility to load/change an image and/or draw a signature in a picture box when it is displayed in Print Preview. To do this, set the EditOptions.Enabled property to true.


Click the picture box in a previewed document and an editor invokes.



You can draw borders for the picture box to make the editor visible in Print Preview, if an image is not specified.

Refer to the Content Editing in Print Preview topic for details and to the Create an Interactive E-Form tutorial to see how the E-Form demo report uses this picture box mode.


This example demonstrates how to create an XRPictureBox object and set 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