←Select platform

ImageViewerSpyGlassInteractiveMode Class


Draws and pans a spy glass on the viewer.

public class ImageViewerSpyGlassInteractiveMode : ImageViewerInteractiveMode 
@interface LTImageViewerSpyGlassInteractiveMode : LTImageViewerInteractiveMode 
public ref class ImageViewerSpyGlassInteractiveMode : ImageViewerInteractiveMode 

ImageViewerSpyGlassInteractiveMode derives from ImageViewerInteractiveMode and subscribes to the following events of the InteractiveService:

The mode will set InteractiveEventArgs.IsHandled to true under the normal conditions for these events.

The ImageViewerSpyGlassInteractiveMode interactive mode does not perform any action on the viewer (besides drawing the the spy glass). It is up to the user to implement any custom operation required, (for example, to implement a magnify glass). The ImageViewerMagnifyGlassInteractiveMode derives from the ImageViewerSpyGlassInteractiveMode and overrides the OnDrawImage method to draw a magnified version of the area under the spy glass.

The ImageViewerSpyGlassInteractiveMode also supports redirecting the output to an external control instead of the viewer surface. For an example, refer to RedirectControl.

For more information, refer to Image Viewer Interactive Modes.


This example will use ImageViewerSpyGlassInteractiveMode to show an inverted portion of the image under the mouse.

Start with the ImageViewer example, remove all the code inside the example function (search for the "// TODO: add example code here" comment) and insert the following code:

using Leadtools; 
using Leadtools.Controls; 
using Leadtools.Codecs; 
using Leadtools.Drawing; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Color; 
var spyGlass = new ImageViewerSpyGlassInteractiveMode(); 
spyGlass.BackgroundBrush = new SolidBrush(Color.FromArgb(128, Color.Yellow)); 
spyGlass.BackgroundBrush = Brushes.Yellow; 
spyGlass.AutoItemMode = ImageViewerAutoItemMode.AutoSet; 
spyGlass.EnsureVisible = false; 

Target Platforms

Help Version 22.0.2023.1.24
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Controls Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.