WindowsFormsSettings.ForcePaintApiDiagnostics(PaintApiDiagnosticsLevel, PaintApiTraceLevelResolver) Method

Allows you to trace all outdated APIs that are not recommended for use with DirectX-rendered and Per-Monitor DPI-aware applications. Starting with version 18.2, also traces Appearance.BackColor properties modified for skinned UI elements.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.Utils.v20.1.dll

Declaration

public static void ForcePaintApiDiagnostics(
    PaintApiDiagnosticsLevel level,
    PaintApiTraceLevelResolver resolver = null
)
Public Shared Sub ForcePaintApiDiagnostics(
    level As PaintApiDiagnosticsLevel,
    resolver As PaintApiTraceLevelResolver = Nothing
)

Parameters

Name Type Description
level DevExpress.Utils.Diagnostics.PaintApiDiagnosticsLevel

A enumerator value that specifies how the application responds to this inadvisable API.

Optional Parameters

Name Type Default Description
resolver DevExpress.Utils.Diagnostics.PaintApiTraceLevelResolver

null

An optional object that allows you to implement a custom trace behavior.

Remarks

The ForcePaintApiDiagnostics method allows you to detect the following issues:

Use the Throw diagnostics level to throw exceptions whenever the unsupported/outdated code is detected.

WindowsFormsSettings.ForcePaintApiDiagnostics(PaintApiDiagnosticsLevel.Throw);

Other available diagnostics levels:

  • Trace - unsupported APIs display result in warnings, displayed in Visual Studio's "Output" window;
WindowsFormsSettings.ForcePaintApiDiagnostics(PaintApiDiagnosticsLevel.Trace);
  • Disable - ignores unsupported API;
  • Default - acts as "Trace" if DirectX and\or Per-Monitor HiDPI support is enabled; otherwise, the same as "Disable".

The optional "resolver" parameter allows you to implement any custom trace behavior.

WindowsFormsSettings.ForcePaintApiDiagnostics(PaintApiDiagnosticsLevel.Trace, (apiLevel, api) => {
    if(api == "ApiName") {
        Console.WriteLine(apiLevel.ToString() + "This API is not recommended: " + api);
        return PaintApiDiagnosticsLevel.Disable;
    }
    return apiLevel;
});
See Also