Leadtools.Windows.Controls Send comments on this topic. | Back to Introduction - LEADTOOLS WPF | Help Version 16.5.9.25
InteractiveMagnifyGlass Event
See Also  Example
Leadtools.Windows.Controls Namespace > BitmapSourceViewer Class : InteractiveMagnifyGlass Event





Occurs when the user is using the MagnifyGlass.

Syntax

Visual Basic (Declaration) 
Public Event InteractiveMagnifyGlass() As InteractiveMagnifyGlassEventHandler
Visual Basic (Usage)Copy Code
Dim instance As BitmapSourceViewer
Dim handler As InteractiveMagnifyGlassEventHandler
 
AddHandler instance.InteractiveMagnifyGlass, handler
C# 
public event InteractiveMagnifyGlassEventHandler InteractiveMagnifyGlass()
C++/CLI 
public:
event InteractiveMagnifyGlassEventHandler^ InteractiveMagnifyGlass();
XAML Attributes Usage 

<object InteractiveMagnifyGlass=EventHandler<ExceptionRoutedEventArgs>/> ...

Routed Event Information 

Identifier field

InteractiveMagnifyGlassEvent

Routing strategy

Bubbling

Delegate

InteractiveMagnifyGlassEventHandler

XAML Attributes Usage 

<object InteractiveMagnifyGlass=EventHandler<ExceptionRoutedEventArgs>/> ...

Routed Event Information 

Identifier field

InteractiveMagnifyGlassEvent

Routing strategy

Bubbling

Delegate

InteractiveMagnifyGlassEventHandler

Example

This example lets you drag the mouse to magnify parts of the image. Also, it displays the contents of the InteractiveMagnifyGlass event in the console.

Visual BasicCopy Code
Private Sub viewer_InteractiveMagnifyGlass(ByVal sender As Object, ByVal e As BitmapSourceViewerLineEventArgs)
    Dim BitmapSourceViewer As BitmapSourceViewer = CType(IIf(TypeOf sender Is BitmapSourceViewer, sender, Nothing), BitmapSourceViewer)
    If e.Status = BitmapSourceViewerInteractiveStatus.Begin Then
        BitmapSourceViewer.Cursor = Cursors.None
    ElseIf e.Status = BitmapSourceViewerInteractiveStatus.End Then
        BitmapSourceViewer.Cursor = Cursors.Arrow
    End If
    Console.WriteLine("InteractiveMagnifyGlass: e.Begin {0}, e.End{1}, e.Status {2}, e.Cancel {3}", e.Begin, e.End, e.Status, e.Cancel)
End Sub
Public Sub BitmapSourceViewer_InteractiveMagnifyGlass(ByVal viewer As BitmapSourceViewer)
    viewer.InteractiveMode = BitmapSourceViewerInteractiveMode.MagnifyGlass
    AddHandler viewer.InteractiveMagnifyGlass, AddressOf viewer_InteractiveMagnifyGlass

    ' Drag mouse across image to see the magnifying glass
    ' After you are done, you must remove the event handler as in below
    '
    ' viewer.InteractiveMagnifyGlass -= new BitmapSourceViewer.InteractiveMagnifyGlassEventHandler(viewer_InteractiveMagnifyGlass);
End Sub
C#Copy Code
private void viewer_InteractiveMagnifyGlass(object sender, BitmapSourceViewerLineEventArgs e) 

   BitmapSourceViewer BitmapSourceViewer = sender as BitmapSourceViewer; 
   if (e.Status == BitmapSourceViewerInteractiveStatus.Begin) 
      BitmapSourceViewer.MagnifyGlass.Cursor = Cursors.None; 
   else if (e.Status == BitmapSourceViewerInteractiveStatus.End) 
      BitmapSourceViewer.MagnifyGlass.Cursor = Cursors.Arrow; 
   Console.WriteLine("InteractiveMagnifyGlass: e.Begin {0}, e.End{1}, e.Status {2}, e.Cancel {3}", e.Begin, e.End, e.Status, e.Cancel); 

public void BitmapSourceViewer_InteractiveMagnifyGlass(BitmapSourceViewer viewer) 

   viewer.InteractiveMode = BitmapSourceViewerInteractiveMode.MagnifyGlass; 
   viewer.InteractiveMagnifyGlass += new InteractiveMagnifyGlassEventHandler(viewer_InteractiveMagnifyGlass); 
 
   // Drag mouse across image to see the magnifying glass 
   // After you are done, you must remove the event handler as in below 
   // 
   // viewer.InteractiveMagnifyGlass -= new BitmapSourceViewer.InteractiveMagnifyGlassEventHandler(viewer_InteractiveMagnifyGlass); 
}
XAMLCopy Code
<Window x:Class="WPFSamples.BitmapSourceViewer" Height="600" Width="800" Title="Interactive MagnifyGlass Sample" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Leadtools_Windows_Controls="clr-namespace:Leadtools.Windows.Controls;assembly=Leadtools.Windows.Controls"> 
  <DockPanel> 
    <Leadtools_Windows_Controls:BitmapSourceViewer Name="theViewer" Source="file:///C:\Program Files\LEAD Technologies\LEADTOOLS 16\Images\slave.jpg" DockPanel.Dock="Bottom" HorizontalAlignment="Center" VerticalAlignment="Bottom" InteractiveMode="MagnifyGlass" MagnifyGlass="150, 150, 1.5" InteractiveMagnifyGlass="viewer_InteractiveMagnifyGlass" /> 
  </DockPanel> 
</Window>

Remarks

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Vista, and Windows Server 2003 family

See Also