External control that can be used to re-direct the spy glass render.
public Control RedirectControl { get; set; }
public:
property System::Windows::Forms::Control^ RedirectControl
{
System::Windows::Forms::Control^ get()
void set(System::Windows::Forms::Control^ value)
}
The external control that can be used to re-direct the spy glass render. Default value is null.
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.
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";
}
ImageViewerSpyGlassInteractiveMode Class
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document