Skip to main content

MagnifierDialog Class

The Magnifier that allows users to pick colors from anywhere around the screen.

Namespace: DevExpress.Utils

Assembly: DevExpress.Utils.v24.1.dll

NuGet Packages: DevExpress.Utils, DevExpress.Wpf.Core

Declaration

public static class MagnifierDialog

Remarks

The MagnifierDialog class allows you to utilize the Magnifier from the WinForms Skin Editor as a stand-alone tool.

Magnifier - Thumbnail Image

End-users can use the mouse scroll wheel to zoom in and out. To copy the hovered color to the clipboard, click the left mouse button. The right button and the “Esc” key close the Magnifier.

To invoke the Magnifier, call its MagnifierDialog.ShowDialog method. When used without parameters, the method invokes the Magnifier with default settings.

MagnifierDialog.ShowDialog();

Other overloads allow you to pass the MagnifierDialogArgs object as a parameter to display a pre-customized Magnifier.

private void simpleButton2_Click(object sender, EventArgs e) {
    MagnifierDialogArgs args = new MagnifierDialogArgs() {
        CloseOnMouseClick = false,
        InitialZoomFactor = 1.25f,
        PickColorToClipboard = false,
        ColorFormat = ColorFormat.Hex
    };
    MagnifierDialogResult result = MagnifierDialog.ShowDialog(this, args);
}

The ShowDialog method returns the MagnifierDialogResult type object when the Magnifier closes. This object allows you to retrieve colors.

private void simpleButton1_Click(object sender, EventArgs e) {
     MagnifierDialogResult result = MagnifierDialog.ShowDialog();
     //the last color under the Magnifier crosshair
     Color hover = result.HoverColor;
     //the color a user has chosen (left mouse click)
     Color? selected = result.SelectedColor;
     //the last remembered zoom factor (use the scroll wheel to zoom in and out)
     float zoom = result.ZoomFactor;
 }

Inheritance

Object
MagnifierDialog
See Also