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

ImageCollectionItem Class

An object that provides an image and its caption.

Namespace: DevExpress.XtraPrinting.Preview

Assembly: DevExpress.XtraPrinting.v19.2.dll

Declaration

public class ImageCollectionItem

Remarks

When you register a custom image editor (see RegisterImageEditor(String, String, ImageEditorOptions)) to edit the XRPictureBox‘s content in Print Preview, you can specify the PredefinedImages image collection. This collection is displayed in the image editor and enables end users to select one of the predefined images.

Predefined Images

Create the ImageCollectionItem objects to populate the PredefinedImages image collection. Specify the Image and Caption (optionally) properties for each item.

The following code snippet demonstrates how you can specify the PredefinedImages collection.

using System.Collections.Generic;
using System.IO;
using DevExpress.XtraPrinting.Preview;
using System.Drawing;

//...

Dictionary<string, Image> images = new Dictionary<string, Image>();
foreach (var file in Directory.GetFiles("Images/Flags", "*.png")) {
    Image img = Image.FromFile(file);
    if (img != null) {
        string imageName = Path.GetFileNameWithoutExtension(file);
        images.Add(imageName, img);
    }
};
ImageEditorOptions imageEditorOptions = new ImageEditorOptions() {
    AllowLoadImage = false,
    AllowChangeSizeOptions = false,
    AllowDraw = false,
    AllowClear = true
};
foreach (var image in images)
    imageEditorOptions.PredefinedImages.Add(new ImageCollectionItem(image.Value, image.Key));
EditingFieldExtensionsWin.Instance.RegisterImageEditor("Nationality", "Nationality", imageEditorOptions);

Note

If you do not set captions for all Image Collection Items, search is not available in the image editor’s predefined collection.

Inheritance

Object
ImageCollectionItem
See Also