Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

MagnifierDialog Class

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

Namespace: DevExpress.Utils

Assembly: DevExpress.Utils.v24.2.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