Gets or sets the RasterMagnifyGlass object used to perform Magnifying Glass operations for this RasterImageViewer.
[BrowsableAttribute(false)]
public virtual Leadtools.Winforms.RasterMagnifyGlass MagnifyGlass {get; set;}
<BrowsableAttribute(False)>
Public Overridable Property MagnifyGlass As Leadtools.Winforms.RasterMagnifyGlass
[BrowsableAttribute(false)]
public:
virtual property Leadtools.Winforms.RasterMagnifyGlass^ MagnifyGlass {
Leadtools.Winforms.RasterMagnifyGlass^ get();
void set ( Leadtools.Winforms.RasterMagnifyGlass^ );
}
The RasterMagnifyGlass object used to perform Magnifying Glass operations for this RasterImageViewer.
Use the AutoInteractiveMagnifyGlass property to control whether the magnifying glass only appears when the current interactive button is down.
You can derive your own class from RasterMagnifyGlass, and then set this property to an instance of that class to perform your own Magnifying Glass processing (for example, change the way the crosshair is displayed).
This sample lets create your own custom magnify glass. The custom magnify glass is drawn with a red "X" for the crosshair The border is a blue rectangle.
Imports Leadtools.WinForms
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing.Color
Imports Leadtools.Drawing
Private Class MyRasterMagnifyGlass : Inherits RasterMagnifyGlass
Public Sub New()
Shape = RasterMagnifyGlassShape.Border3D
End Sub
Protected Overrides Sub OnPaintBorder(ByVal graphics As Graphics, ByVal centerPoint As Point)
Dim width As Integer = (Size.Width - 2) \ 2
Dim height As Integer = (Size.Height - 2) \ 2
Dim rc As Rectangle = New Rectangle(centerPoint.X - width, centerPoint.Y - height, 2 * width, 2 * height)
graphics.DrawRectangle(Pens.Blue, rc)
End Sub
Protected Overrides Sub OnPaintCrosshair(ByVal graphics As Graphics, ByVal centerPoint As Point)
Dim width As Integer = (Size.Width - 2) \ 2
Dim height As Integer = (Size.Height - 2) \ 2
Dim p1 As Point = New Point(centerPoint.X - width, centerPoint.Y - height)
Dim p2 As Point = New Point(centerPoint.X + width, centerPoint.Y + height)
graphics.DrawLine(Pens.Red, p1, p2)
p1 = New Point(centerPoint.X + width, centerPoint.Y - height)
p2 = New Point(centerPoint.X - width, centerPoint.Y + height)
graphics.DrawLine(Pens.Red, p1, p2)
End Sub
End Class
Private Sub viewer_MagnifyGlassChanged(ByVal sender As Object, ByVal e As EventArgs)
MessageBox.Show("Custom Magnify Glass being used -- red X for crosshair, blue for border")
End Sub
Public Sub RasterImageViewer_MagnifyGlass(ByVal viewer As RasterImageViewer)
AddHandler viewer.MagnifyGlassChanged, AddressOf viewer_MagnifyGlassChanged
viewer.MagnifyGlass = New MyRasterMagnifyGlass()
viewer.InteractiveMode = RasterViewerInteractiveMode.MagnifyGlass
RemoveHandler viewer.MagnifyGlassChanged, AddressOf viewer_MagnifyGlassChanged
End Sub
using Leadtools.WinForms;
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing.Color;
using Leadtools.Drawing;
class MyRasterMagnifyGlass : RasterMagnifyGlass
{
public MyRasterMagnifyGlass()
{
Shape = RasterMagnifyGlassShape.Border3D;
}
protected override void OnPaintBorder(Graphics graphics, Point centerPoint)
{
int width = (Size.Width - 2) / 2;
int height = (Size.Height - 2) / 2;
Rectangle rc = new Rectangle(centerPoint.X - width, centerPoint.Y - height, 2*width, 2*height);
graphics.DrawRectangle(Pens.Blue, rc);
}
protected override void OnPaintCrosshair(Graphics graphics, Point centerPoint)
{
int width = (Size.Width - 2) / 2;
int height = (Size.Height - 2) / 2;
Point p1 = new Point(centerPoint.X - width, centerPoint.Y - height);
Point p2 = new Point(centerPoint.X + width, centerPoint.Y + height);
graphics.DrawLine(Pens.Red, p1, p2);
p1 = new Point(centerPoint.X + width, centerPoint.Y - height);
p2 = new Point(centerPoint.X - width, centerPoint.Y + height);
graphics.DrawLine(Pens.Red, p1, p2);
}
}
private void viewer_MagnifyGlassChanged(object sender, EventArgs e)
{
MessageBox.Show("Custom Magnify Glass being used -- red X for crosshair, blue for border");
}
public void RasterImageViewer_MagnifyGlass(RasterImageViewer viewer)
{
viewer.MagnifyGlassChanged+= new EventHandler(viewer_MagnifyGlassChanged);
viewer.MagnifyGlass = new MyRasterMagnifyGlass();
viewer.InteractiveMode = RasterViewerInteractiveMode.MagnifyGlass;
viewer.MagnifyGlassChanged -= new EventHandler(viewer_MagnifyGlassChanged);
}
Products |
Support |
Feedback: MagnifyGlass Property - Leadtools.WinForms |
Introduction |
Help Version 19.0.2017.3.22
|
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.