Private Sub magnifyGlass_CrosshairChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of MagnifyGlassCrosshair))
Dim magnifyGlass As MagnifyGlass = TryCast(sender, MagnifyGlass)
Console.WriteLine("Crosshair Changed to " & magnifyGlass.Crosshair.ToString())
End Sub
Private Sub magnifyGlass_CrosshairBrushChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of Brush))
Dim magnifyGlass As MagnifyGlass = TryCast(sender, MagnifyGlass)
Console.WriteLine("CrosshairBrush Changed to " & magnifyGlass.CrosshairBrush.ToString())
End Sub
Private Sub magnifyGlass_CrosshairThicknessChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of Double))
Dim magnifyGlass As MagnifyGlass = TryCast(sender, MagnifyGlass)
Console.WriteLine("CrosshairThickness Changed to " & magnifyGlass.CrosshairThickness.ToString())
End Sub
Private Sub magnifyGlass_BorderBrushChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of Brush))
Dim magnifyGlass As MagnifyGlass = TryCast(sender, MagnifyGlass)
Console.WriteLine("BorderBrush Changed to " & magnifyGlass.BorderBrush.ToString())
End Sub
Private Sub magnifyGlass_BorderThicknessChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of Double))
Dim magnifyGlass As MagnifyGlass = TryCast(sender, MagnifyGlass)
Console.WriteLine("BorderThickness Changed to " & magnifyGlass.BorderThickness.ToString())
End Sub
Private Sub magnifyGlass_ShapeChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of MagnifyGlassShape))
Dim magnifyGlass As MagnifyGlass = TryCast(sender, MagnifyGlass)
Console.WriteLine("Shape Changed to " & magnifyGlass.Shape.ToString())
End Sub
Private Sub magnifyGlass_ScaleFactorChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of Double))
Dim magnifyGlass As MagnifyGlass = TryCast(sender, MagnifyGlass)
Console.WriteLine("Scale Factor Changed to " & magnifyGlass.ScaleFactor.ToString())
End Sub
Private Sub magnifyGlass_RoundRectangleRadiusChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of Size))
Dim magnifyGlass As MagnifyGlass = TryCast(sender, MagnifyGlass)
Console.WriteLine("RoundRectangleRadius Changed to " & magnifyGlass.RoundRectangleRadius.ToString())
End Sub
Private Sub magnifyGlass_BackgroundChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of Brush))
Dim magnifyGlass As MagnifyGlass = TryCast(sender, MagnifyGlass)
Console.WriteLine("Background Changed to " & magnifyGlass.Background.ToString())
End Sub
Public Sub MagnifyGlass_Shape(ByVal viewer As ImageViewer)
viewer.InteractiveMode = InteractiveMode.MagnifyGlass
AddHandler viewer.MagnifyGlass.CrosshairChanged, AddressOf magnifyGlass_CrosshairChanged
AddHandler viewer.MagnifyGlass.CrosshairBrushChanged, AddressOf magnifyGlass_CrosshairBrushChanged
AddHandler viewer.MagnifyGlass.CrosshairThicknessChanged, AddressOf magnifyGlass_CrosshairThicknessChanged
AddHandler viewer.MagnifyGlass.BorderBrushChanged, AddressOf magnifyGlass_BorderBrushChanged
AddHandler viewer.MagnifyGlass.BorderThicknessChanged, AddressOf magnifyGlass_BorderThicknessChanged
AddHandler viewer.MagnifyGlass.ShapeChanged, AddressOf magnifyGlass_ShapeChanged
AddHandler viewer.MagnifyGlass.ScaleFactorChanged, AddressOf magnifyGlass_ScaleFactorChanged
AddHandler viewer.MagnifyGlass.RoundRectangleRadiusChanged, AddressOf magnifyGlass_RoundRectangleRadiusChanged
AddHandler viewer.MagnifyGlass.BackgroundChanged, AddressOf magnifyGlass_BackgroundChanged
If viewer.MagnifyGlass.Shape <> MagnifyGlassShape.Border3D Then
' Set the crosshair style
viewer.MagnifyGlass.Shape = MagnifyGlassShape.Border3D
' Now change to a different shape
viewer.MagnifyGlass.Shape = MagnifyGlassShape.RoundRectangle
viewer.MagnifyGlass.RoundRectangleRadius = New Size(15, 15)
viewer.MagnifyGlass.BorderBrush = Brushes.DarkBlue
viewer.MagnifyGlass.BorderThickness = 10
viewer.MagnifyGlass.Crosshair = MagnifyGlassCrosshair.Fine
viewer.MagnifyGlass.CrosshairBrush = Brushes.Red
viewer.MagnifyGlass.CrosshairThickness = 5
viewer.MagnifyGlass.Size = New Size(200, 200)
viewer.MagnifyGlass.Background = Brushes.DarkGreen
viewer.MagnifyGlass.ScaleFactor = 1.5f
End If
RemoveHandler viewer.MagnifyGlass.CrosshairChanged, AddressOf magnifyGlass_CrosshairChanged
RemoveHandler viewer.MagnifyGlass.CrosshairBrushChanged, AddressOf magnifyGlass_CrosshairBrushChanged
RemoveHandler viewer.MagnifyGlass.CrosshairThicknessChanged, AddressOf magnifyGlass_CrosshairThicknessChanged
RemoveHandler viewer.MagnifyGlass.BorderBrushChanged, AddressOf magnifyGlass_BorderBrushChanged
RemoveHandler viewer.MagnifyGlass.BorderThicknessChanged, AddressOf magnifyGlass_BorderThicknessChanged
RemoveHandler viewer.MagnifyGlass.ShapeChanged, AddressOf magnifyGlass_ShapeChanged
RemoveHandler viewer.MagnifyGlass.ScaleFactorChanged, AddressOf magnifyGlass_ScaleFactorChanged
RemoveHandler viewer.MagnifyGlass.RoundRectangleRadiusChanged, AddressOf magnifyGlass_RoundRectangleRadiusChanged
RemoveHandler viewer.MagnifyGlass.BackgroundChanged, AddressOf magnifyGlass_BackgroundChanged
End Sub |