←Select platform

ImageViewerMagnifyGlassInteractiveMode Class


Shows a magnified version of the image on top of the viewer.

public class ImageViewerMagnifyGlassInteractiveMode : ImageViewerSpyGlassInteractiveMode 
@interface LTImageViewerMagnifyGlassInteractiveMode : LTImageViewerSpyGlassInteractiveMode<NSCoding> 
public ref class ImageViewerMagnifyGlassInteractiveMode : ImageViewerSpyGlassInteractiveMode 

ImageViewerMagnifyGlassInteractiveMode derives from ImageViewerSpyGlassInteractiveMode and waits for the DrawImage event. When this event fires, it will then use the ScaleFactor value to draw a magnified version of the image area underneath the spy glass on top of the viewer.

Drawing a rubber-band on the viewer is usually followed by another user operation to perform the action. In most cases, the rubber band is to be restricted on the "work" area. The RestrictToWorkBounds can control this behavior.

This interactive mode does not subscribe to any additional events from the InteractiveService beyond those in ImageViewerSpyGlassInteractiveMode and does not set InteractiveEventArgs.IsHandled to true in any additional way.

For more information, refer to Image Viewer Interactive Modes.

using Leadtools; 
using Leadtools.Controls; 
using Leadtools.Codecs; 
using Leadtools.Drawing; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Color; 
public void ImageViewer_Example() 
   // Create the form that holds the ImageViewer 
   new MyForm().ShowDialog(); 
class MyForm : Form 
   public MyForm() 
      this.Size = new Size(800, 800); 
   // LEADTOOLS ImageViewer to be used with this example 
   private ImageViewer _imageViewer; 
   // Information label 
   private Label _label; 
   protected override void OnLoad(EventArgs e) 
      // Create a panel to the top 
      var panel = new Panel(); 
      panel.Dock = DockStyle.Top; 
      panel.BorderStyle = BorderStyle.FixedSingle; 
      // Add an "Example" button to the panel 
      var button = new Button(); 
      button.Text = "&Example"; 
      button.Click += (sender, e1) => Example(); 
      // Add a label to the panel 
      _label = new Label(); 
      _label.Top = button.Bottom; 
      _label.Width = 800; 
      _label.Text = "Example..."; 
      // Create the image viewer taking the rest of the form 
      _imageViewer = new ImageViewer(); 
      _imageViewer.Dock = DockStyle.Fill; 
      _imageViewer.BackColor = Color.Bisque; 
      // Add Pan/Zoom interactive mode 
      // Click and drag to pan, CTRL-Click and drag to zoom in and out 
      _imageViewer.DefaultInteractiveMode = new ImageViewerPanZoomInteractiveMode(); 
      // Load an image 
      using (var codecs = new RasterCodecs()) 
         _imageViewer.Image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "image1.cmp")); 
   private void Example() 
      // Example code goes here 
static class LEAD_VARS 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 

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.