Using the Magnifying Glass

LEADTOOLS provides a "magnifying glass" for the Main Control. This magnifying glass provides a means of "zooming in" on the image loaded into the Main Control. To start the magnifying glass procedure, call the StartMagGlass method. The user can check the HasMagGlass property to determine whether the control has a magnifying glass attached to it. As the magnifying glass is moved over an image, the zoomed - in view is also displayed.

Two scenarios can be followed when working with the magnifying glass:

1. The user can work with an ordinary magnifying glass that will be attached to the control’s window. There is no need to write any code to show the magnifying glass or to move it over the image, since this will be handled internally by LEADTOOLS. This scenario can be achieved by calling the StartMagGlass method, but without setting MAGGLASS_MANUAL_UPDATE in the MagGlassFlags property.

2. In the second scenario, the user is responsible for handling WM_LBUTTONDOWN, WM_LBUTTONDBLCLK, WM_LBUTTONUP, WM_MOUSEMOVE, WM_SETCURSOR and WM_KILLFOCUS messages instead of handling them internally by LEADTOOLS. This scenario requires that MAGGLASS_MANUAL_UPDATE be set in the MagGlassFlags property. When updating the magnifying glass manually, the ShowMagGlass method will show/hide the magnifying glass while the SetMagGlassPos method will move the magnifying glass to a specified position. The UpdateMagGlassFromHandle method can be used to update the bitmap that the magnifying glass displays in the zoomed display area.

The following can be set using the StartMagGlass method:

To set masks for certain colors to be masked from the zoomed - in display, LEADTOOLS provides the MagGlassMaskCount property and the MagGlassMask property.

The MagGlassFlags property controls two behaviors of the magnifying glass:

1. which colors in the bitmap to display and which to mask.

2. enables or disables the manual updating of the magnifying glass

LEADTOOLS provides two defined shapes for the Magnifying Glass: Rectangle and Ellipse. The UpdateMagGlassShape method lets you update the shape of the magnifying glass to one of the previously listed shapes, or to a custom shape.

To control the painting options for the zoomed display, use the following:

PanWinPaintPalette property

PanWinBitonalScaling property

PanWinPaintDither property

PanWinPaintScaling property

To control the contrast, gamma and intensity of the zoomed area, use the following:

MagGlassPaintContrast property

MagGlassPaintGamma property

MagGlassPaintIntensity property

To use a custom shape for the magnifying glass, use the following:

PanWinPointer = 99 ' custom pointer
PanWinCursor
= the custom cursor image

When the magnifying glass is no longer needed, call the StopMagGlass method to stop the magnifying glass procedure.