EditingFieldExtensionsWin.RegisterImageCollectionEditor(String, String, IDictionary<String, Image>, Boolean, Boolean) Method
Registers an image editor with a filterable collection of predefined named images to be used for changing image content in Print Preview.
Namespace: DevExpress.XtraPrinting.Preview
Assembly: DevExpress.XtraPrinting.v18.2.dll
Declaration
public virtual bool RegisterImageCollectionEditor(
string name,
string displayName,
IDictionary<string, Image> images,
bool searchEnabled,
bool sizeOptionsEnabled
)
Parameters
Name | Type | Description |
---|---|---|
name | String | The name of the registered image collection editor. |
displayName | String | The display name of the registered image collection editor. |
images | IDictionary<String, Image> | The editor’s image collection. |
searchEnabled | Boolean | true, if the editor allows end users to use incremental search in the image collection; otherwise, false. |
sizeOptionsEnabled | Boolean | true, if the editor allows end users to set up the image’s size and alignment options; otherwise, false. |
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.XtraPrinting.Preview;
//...
Dictionary<string, Image> images = new Dictionary<string, Image>();
foreach (var file in Directory.GetFiles("../../Flags/", "*.png")) {
Image img = Image.FromFile(file);
if (img != null) {
string name = Path.GetFileNameWithoutExtension(file);
images.Add(name, img);
}
}
EditingFieldExtensionsWin.Instance.RegisterImageCollectionEditor("Nationality", "Nationality", images, true, false);
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 Property Grid.
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 activates. This editor allows end users to use incremental search to find an image in the collection, set up the image’s size and alignment options, and reset the initial image.