- 4 minutes to read
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.
Specify the following properties to set an image:
Use this property to save images along with a report definition.
Use this property to save only the path to the 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.
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:
- 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)
- 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.
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.