EditingFieldExtensions.RegisterImageCollectionEditorInfo(String, IEnumerable<Image>, Boolean, String) Method
Registers an image editor with a collection of predefined images to be used for changing image content in Print Preview.
Namespace: DevExpress.Xpf.Printing
Assembly: DevExpress.Xpf.Printing.v19.1.dll
Declaration
public bool RegisterImageCollectionEditorInfo(
string editorName,
IEnumerable<Image> images,
bool sizeOptionsEnabled = false,
string displayName = null
)
Parameters
Name | Type | Description |
---|---|---|
editorName | String | The name of the registered image collection editor. |
images | IEnumerable<Image> | The editor’s image collection. |
Optional Parameters
Name | Type | Default | Description |
---|---|---|---|
sizeOptionsEnabled | Boolean | False | true, if the editor allows end users to specify image size options; otherwise, false. |
displayName | String | *null* | The display name of the registered image collection editor. |
Returns
Type | Description |
---|---|
Boolean | true, if the image list has been successfully registered; otherwise, false. |
Remarks
Use this method to register an image editor with a collection of predefined images in the application.
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using DevExpress.Xpf.Printing;
//...
List<Image> images = new List<Image>();
foreach (var file in Directory.GetFiles("../../Flags/", "*.png")) {
Image img = Image.FromFile(file);
if (img != null) {
images.Add(img);
}
}
EditingFieldExtensions.Instance.RegisterImageCollectionEditorInfo("Nationality", images, false, "Nationality");
To use this editor for image editing in Print Preview, set a XRPictureBox control’s EditOptions | Enabled property to true and the EditOptions | EditorName property - to the registered editor’s name.
Set image edit options in the End-User Report Designer’s Properties window.
The following sample demonstrates how to do this in code.
using DevExpress.XtraReports.UI;
//...
XtraReport1 report = new XtraReport1();
XRPictureBox pictureBox = report.Bands["ReportHeader"].FindControl("xrPictureBox1", true) as XRPictureBox;
pictureBox.EditOptions.Enabled = true;
pictureBox.EditOptions.EditorName = "Nationality";
When an end user clicks the Picture Box in Print Preview, the assigned editor is activated. This editor allows end users to choose a predefined image or reset to the initial image.
Note
Use the RegisterImageEditorInfo(String, ImageEditorOptions, String) method instead if you need to add the Brush Options and/or Load Image menu items as well.