←Select platform

RedirectControl Property

Summary

External control that can be used to re-direct the spy glass render.

Syntax
C#
C++/CLI
public Control RedirectControl { get; set; } 
public:  
   property System::Windows::Forms::Control^ RedirectControl 
   { 
      System::Windows::Forms::Control^ get() 
      void set(System::Windows::Forms::Control^ value) 
   } 

Property Value

The external control that can be used to re-direct the spy glass render. Default value is null.

Remarks

ImageViewerSpyGlassInteractiveMode supports redirecting the render output to an external control instead of the area under the mouse in the viewer. When this value is set to a valid control on the form, the interactive mode will subscribe to the control System.Windows.Forms.Control.Paint event and will render the magnifying glass content to the surface of this control. Any Windows Forms will work: however, a custom user control or a System.Windows.Forms.PictureBox control is the most efficient since it supports double buffering.

Example
C#
using Leadtools; 
using Leadtools.Controls; 
using Leadtools.Codecs; 
using Leadtools.Drawing; 
 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Color; 
 
public ImageViewerForm _form = new ImageViewerForm(); 
public ImageViewer _imageViewer; 
 
public void ImageViewerSpyGlassInteractiveModeRedirectControlExample() 
{ 
   // Get the ImageViewer control from the form 
   _imageViewer = _form.ImageViewer; 
 
   // Load an image 
   using (var codecs = new RasterCodecs()) 
      _imageViewer.Image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "image1.cmp")); 
 
   // Separate Form with PictureBox control 
   Form redirectRenderForm = new Form(); 
   PictureBox redirectControl = new PictureBox(); 
   redirectControl.Width = 400; 
   redirectControl.Dock = DockStyle.Fill; 
   redirectControl.BackColor = Color.Gray; 
   redirectRenderForm.Controls.Add(redirectControl); 
   redirectRenderForm.Show(); 
 
   ImageViewerSpyGlassInteractiveMode spyglass = new ImageViewerSpyGlassInteractiveMode(); 
   spyglass.RedirectControl = redirectControl; 
   spyglass.DrawImage += (sender, e) => 
   { 
      System.Drawing.Image img = RasterImageConverter.ChangeToImage(_imageViewer.Image, new ChangeToImageOptions()); 
      e.Context.DrawImage(img, new PointF((float)e.Offset.ToLeadPointD().X, (float)e.Offset.ToLeadPointD().Y)); 
   }; 
 
   _imageViewer.InteractiveModes.BeginUpdate(); 
   _imageViewer.InteractiveModes.Add(spyglass); 
   _imageViewer.InteractiveModes.EndUpdate(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
Requirements

Target Platforms

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

Leadtools.Controls Assembly

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