Back to Devexpress

EditingFieldExtensions.RegisterImageEditorInfo(String, ImageEditorOptions, String) Method

wpf-devexpress-dot-xpf-dot-printing-dot-editingfieldextensions-dot-registerimageeditorinfo-x28-system-dot-string-devexpress-dot-xpf-dot-printing-dot-imageeditoroptions-system-dot-string-x29.md

latest5.8 KB
Original Source

EditingFieldExtensions.RegisterImageEditorInfo(String, ImageEditorOptions, String) Method

Registers a custom image editor that you can use to edit the XRPictureBox‘s content in Print Preview.

Namespace : DevExpress.Xpf.Printing

Assembly : DevExpress.Xpf.Printing.v25.2.dll

NuGet Package : DevExpress.Wpf.Printing

Declaration

csharp
public bool RegisterImageEditorInfo(
    string editorName,
    ImageEditorOptions options,
    string displayName = null
)
vb
Public Function RegisterImageEditorInfo(
    editorName As String,
    options As ImageEditorOptions,
    displayName As String = Nothing
) As Boolean

Parameters

NameTypeDescription
editorNameString

The registered image editor’s unique name.

| | options | ImageEditorOptions |

An object that provides settings for the registered image editor.

|

Optional Parameters

NameTypeDefaultDescription
displayNameStringnull

The registered image editor’s display name.

|

Returns

TypeDescription
Boolean

true, if the image editor has been successfully registered; otherwise, false.

|

Remarks

You can use one of the predefined image editors in Print Preview:

“Image”“Signature”“Image and Signature”

Use the RegisterImageEditorInfo method to register an image editor with a custom set of menu items. Pass an object of the ImageEditorOptions type as the method’s options parameter.

csharp
using DevExpress.Xpf.Printing;

//...

ImageEditorOptions imageEditorOptions = new ImageEditorOptions() {
    AllowLoadImage = false,
    AllowChangeSizeOptions = false,
    AllowDraw = true,
    AllowClear = false
};
EditingFieldExtensions.Instance.RegisterImageEditorInfo("DamageDiagram", imageEditorOptions, "Damage Diagram");
vb
Imports DevExpress.Xpf.Printing

'...

Private imageEditorOptions As New ImageEditorOptions() With {
    .AllowLoadImage = False,
    .AllowChangeSizeOptions = False,
    .AllowDraw = True,
    .AllowClear = False
}
EditingFieldExtensions.Instance.RegisterImageEditorInfo("DamageDiagram", imageEditorOptions, "Damage Diagram")

Note

The menu item resets the editor’s content. This item is available only when the Picture Box control has an original image (see ImageSource).

You can also add the item to the image editor’s menu. This item allows end users to choose one of the predefined images and load it to the editor. Use the PredefinedImages property to specify the predefined image collection.

To use the registered editor in Print Preview, set a XRPictureBox control’s EditOptions | Enabled property to true and the EditOptions | EditorName property - to the registered editor’s name.

The following sample demonstrates how to do this in code.

csharp
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 = "DamageDiagram";
vb
Imports DevExpress.XtraReports.UI

'...

Private report As New XtraReport1()
Private pictureBox As XRPictureBox = TryCast(report.Bands("ReportHeader").FindControl("xrPictureBox1", True), XRPictureBox)
pictureBox.EditOptions.Enabled = True
pictureBox.EditOptions.EditorName = "DamageDiagram"

An end user can set the registered image editor in the End-User Report Designer’s Property Grid.

The following image demonstrates the registered image editor that allows end users to draw only.

See Also

ImageInplaceEditorInfo

EditingFieldExtensions Class

EditingFieldExtensions Members

DevExpress.Xpf.Printing Namespace