←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; 
 
Panel panel = new Panel(); 
panel.Width = 300; 
panel.Dock = DockStyle.Right; 
_control.Controls.Add(panel); 
panel.BringToFront(); 
 
Label label = new Label(); 
label.Text = "Double click to switch between viewer and here"; 
label.AutoSize = true; 
label.Dock = DockStyle.Top; 
panel.Controls.Add(label); 
 
// Any control will do, but a PictureBox is perfect since it does double buffering 
PictureBox redirectControl = new PictureBox(); 
redirectControl.Dock = DockStyle.Fill; 
redirectControl.BackColor = Color.Gray; 
panel.Controls.Add(redirectControl); 
redirectControl.BringToFront(); 
redirectControl.Visible = false; 
 
_imageViewer.BringToFront(); 
 
ImageViewerMagnifyGlassInteractiveMode mode = new ImageViewerMagnifyGlassInteractiveMode(); 
mode.WorkStarted += (sender, e) => 
{ 
   if (mode.RedirectControl != null) 
      mode.RedirectControl.Visible = true; 
}; 
 
mode.WorkCompleted += (sender, e) => 
{ 
   if (mode.RedirectControl != null) 
      mode.RedirectControl.Visible = false; 
}; 
 
mode.RedirectControl = redirectControl; 
 
panel.MouseDoubleClick += (sender, e) => 
{ 
   if (mode.RedirectControl == null) 
      mode.RedirectControl = redirectControl; 
   else 
      mode.RedirectControl = null; 
}; 
 
_imageViewer.InteractiveModes.BeginUpdate(); 
_imageViewer.InteractiveModes.Add(mode); 
_imageViewer.InteractiveModes.EndUpdate(); 
 
foreach (var shape in Enum.GetValues(typeof(ImageViewerSpyGlassShape))) 
   _shapeComboBox.Items.Add(shape); 
_shapeComboBox.SelectedItem = mode.Shape; 
_shapeComboBox.SelectedIndexChanged += (sender, e) => mode.Shape = (ImageViewerSpyGlassShape)_shapeComboBox.SelectedItem; 
Requirements

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.