Picture Box

This document explains how to use the XRPictureBox control is your reports.

Picture Box Overview

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:18.2: Report Controls Toolbox tab and drop it onto the report.

Versions_DropControl_XRPictureBox

Specify the following properties to set an image:

xrpicturebox-02

Note

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.

    report-control-picturebox-0

    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.

Illustration

Description

ImageSizeMode-Normal

ImageSizeMode.Normal

The image is displayed with its original dimensions.

ImageSizeMode-StretchImage

ImageSizeMode.StretchImage

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

ImageSizeMode-AutoSize

ImageSizeMode.AutoSize

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

ImageSizeMode-ZoomImage

ImageSizeMode.ZoomImage

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

ImageSizeMode-Squeeze

ImageSizeMode.Squeeze

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.

ImageSizeMode-Tile

ImageSizeMode.Tile

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.

Interactivity

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.

picture-box-enable-content-editing

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

picture-box-content-editing

Tip

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.