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

DXErrorProvider.GetErrorIcon Event

Allows you to provide custom error icons for editors.

Namespace: DevExpress.XtraEditors.DXErrorProvider

Assembly: DevExpress.XtraEditors.v18.2.dll

Declaration

public static event GetErrorIconEventHandler GetErrorIcon

Remarks

Typically, you need to handle this event to supply user-defined error icons for editors (when an error is associated with an editor and the error type is set to ErrorType.User1, ErrorType.User2 or ErrorType.User3).

It’s also possible to handle this event to replace the standard error icons that correspond to the ErrorType.Critical, ErrorType.Warning and ErrorType.Information error types, with custom ones.

Note

An icon’s size must be 12x12 pixels.

Example

The following example shows how to supply a custom error icon via the DXErrorProvider.GetErrorIcon event. In this event, a custom icon (DXErrorProvider_CustomIcon) is provided when the error type is set to ErrorType.User1.

The result is illustrated below:

DXErrorProvider_GetErrorIcon_ex

using DevExpress.XtraEditors.DXErrorProvider;

DXErrorProvider.GetErrorIcon += new GetErrorIconEventHandler(DXErrorProvider_GetErrorIcon);

// Associate an error of the User1 error type with a buttonEdit1 control.
dxErrorProvider1.SetError(buttonEdit1, "Error", ErrorType.User1);

//...

Image icon = Image.FromFile(@"C:\arrow.png");
// Provide an error icon for the User1 error type.
void DXErrorProvider_GetErrorIcon(GetErrorIconEventArgs e) {
    if (e.ErrorType == ErrorType.User1) {
        e.ErrorIcon = icon;
    }
}
See Also