LEADTOOLS WPF and Silverlight (Leadtools.Windows.Controls assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.30
ShapeChanged Event
See Also 
Leadtools.Windows.Controls Namespace > MagnifyGlass Class : ShapeChanged Event



Occurs when the value of the Shape property changes. Supported in Silverlight, Windows Phone 7

Syntax

Visual Basic (Declaration) 
Public Event ShapeChanged As RoutedPropertyChangedEventHandler(Of MagnifyGlassShape)
Visual Basic (Usage)Copy Code
Dim instance As MagnifyGlass
Dim handler As RoutedPropertyChangedEventHandler(Of MagnifyGlassShape)
 
AddHandler instance.ShapeChanged, handler
C++/CLI 
public:
event RoutedPropertyChangedEventHandler<MagnifyGlassShape>^ ShapeChanged

Example

Visual BasicCopy Code
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
C#Copy Code
private void magnifyGlass_CrosshairChanged(object sender, RoutedPropertyChangedEventArgs<MagnifyGlassCrosshair> e)
{
   MagnifyGlass magnifyGlass = sender as MagnifyGlass;
   Console.WriteLine("Crosshair Changed to " + magnifyGlass.Crosshair.ToString());
}
private void magnifyGlass_CrosshairBrushChanged(object sender, RoutedPropertyChangedEventArgs<Brush> e)
{
   MagnifyGlass magnifyGlass = sender as MagnifyGlass;
   Console.WriteLine("CrosshairBrush Changed to " + magnifyGlass.CrosshairBrush.ToString());
}

private void magnifyGlass_CrosshairThicknessChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
   MagnifyGlass magnifyGlass = sender as MagnifyGlass;
   Console.WriteLine("CrosshairThickness Changed to " + magnifyGlass.CrosshairThickness.ToString());
}

private void magnifyGlass_BorderBrushChanged(object sender, RoutedPropertyChangedEventArgs<Brush> e)
{
   MagnifyGlass magnifyGlass = sender as MagnifyGlass;
   Console.WriteLine("BorderBrush Changed to " + magnifyGlass.BorderBrush.ToString());
}

private void magnifyGlass_BorderThicknessChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
   MagnifyGlass magnifyGlass = sender as MagnifyGlass;
   Console.WriteLine("BorderThickness Changed to " + magnifyGlass.BorderThickness.ToString());
}

private void magnifyGlass_ShapeChanged(object sender, RoutedPropertyChangedEventArgs<MagnifyGlassShape> e)
{
   MagnifyGlass magnifyGlass = sender as MagnifyGlass;
   Console.WriteLine("Shape Changed to " + magnifyGlass.Shape.ToString());
}

private void magnifyGlass_ScaleFactorChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
   MagnifyGlass magnifyGlass = sender as MagnifyGlass;
   Console.WriteLine("Scale Factor Changed to " + magnifyGlass.ScaleFactor.ToString());
}

private void magnifyGlass_RoundRectangleRadiusChanged(object sender, RoutedPropertyChangedEventArgs<Size> e)
{
   MagnifyGlass magnifyGlass = sender as MagnifyGlass;
   Console.WriteLine("RoundRectangleRadius Changed to " + magnifyGlass.RoundRectangleRadius.ToString());
}

private void magnifyGlass_BackgroundChanged(object sender, RoutedPropertyChangedEventArgs<Brush> e)
{
   MagnifyGlass magnifyGlass = sender as MagnifyGlass;
   Console.WriteLine("Background Changed to " + magnifyGlass.Background.ToString());
}

public void MagnifyGlass_Shape(ImageViewer viewer)
{
   viewer.InteractiveMode = InteractiveMode.MagnifyGlass;
   viewer.MagnifyGlass.CrosshairChanged +=new RoutedPropertyChangedEventHandler<MagnifyGlassCrosshair>(magnifyGlass_CrosshairChanged);
   viewer.MagnifyGlass.CrosshairBrushChanged +=new RoutedPropertyChangedEventHandler<Brush>(magnifyGlass_CrosshairBrushChanged);
   viewer.MagnifyGlass.CrosshairThicknessChanged +=new RoutedPropertyChangedEventHandler<double>(magnifyGlass_CrosshairThicknessChanged);
   viewer.MagnifyGlass.BorderBrushChanged +=new RoutedPropertyChangedEventHandler<Brush>(magnifyGlass_BorderBrushChanged);
   viewer.MagnifyGlass.BorderThicknessChanged +=new RoutedPropertyChangedEventHandler<double>(magnifyGlass_BorderThicknessChanged);
   viewer.MagnifyGlass.ShapeChanged +=new RoutedPropertyChangedEventHandler<MagnifyGlassShape>(magnifyGlass_ShapeChanged);
   viewer.MagnifyGlass.ScaleFactorChanged +=new RoutedPropertyChangedEventHandler<double>(magnifyGlass_ScaleFactorChanged);
   viewer.MagnifyGlass.RoundRectangleRadiusChanged +=new RoutedPropertyChangedEventHandler<Size>(magnifyGlass_RoundRectangleRadiusChanged);
   viewer.MagnifyGlass.BackgroundChanged +=new RoutedPropertyChangedEventHandler<Brush>(magnifyGlass_BackgroundChanged);

   if(viewer.MagnifyGlass.Shape != MagnifyGlassShape.Border3D)
   {
      // 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;
   }

   viewer.MagnifyGlass.CrosshairChanged -= new RoutedPropertyChangedEventHandler<MagnifyGlassCrosshair>(magnifyGlass_CrosshairChanged);
   viewer.MagnifyGlass.CrosshairBrushChanged -= new RoutedPropertyChangedEventHandler<Brush>(magnifyGlass_CrosshairBrushChanged);
   viewer.MagnifyGlass.CrosshairThicknessChanged -= new RoutedPropertyChangedEventHandler<double>(magnifyGlass_CrosshairThicknessChanged);
   viewer.MagnifyGlass.BorderBrushChanged -= new RoutedPropertyChangedEventHandler<Brush>(magnifyGlass_BorderBrushChanged);
   viewer.MagnifyGlass.BorderThicknessChanged -= new RoutedPropertyChangedEventHandler<double>(magnifyGlass_BorderThicknessChanged);
   viewer.MagnifyGlass.ShapeChanged -= new RoutedPropertyChangedEventHandler<MagnifyGlassShape>(magnifyGlass_ShapeChanged);
   viewer.MagnifyGlass.ScaleFactorChanged -= new RoutedPropertyChangedEventHandler<double>(magnifyGlass_ScaleFactorChanged);
   viewer.MagnifyGlass.RoundRectangleRadiusChanged -= new RoutedPropertyChangedEventHandler<Size>(magnifyGlass_RoundRectangleRadiusChanged);
   viewer.MagnifyGlass.BackgroundChanged -= new RoutedPropertyChangedEventHandler<Brush>(magnifyGlass_BackgroundChanged);
}
SilverlightCSharpCopy Code
private void magnifyGlass_CrosshairChanged(object sender, RoutedPropertyChangedEventArgs<MagnifyGlassCrosshair> e)
{
   MagnifyGlass magnifyGlass = sender as MagnifyGlass;
   Console.WriteLine("Crosshair Changed to " + magnifyGlass.Crosshair.ToString());
}
private void magnifyGlass_CrosshairBrushChanged(object sender, RoutedPropertyChangedEventArgs<Brush> e)
{
   MagnifyGlass magnifyGlass = sender as MagnifyGlass;
   Console.WriteLine("CrosshairBrush Changed to " + magnifyGlass.CrosshairBrush.ToString());
}

private void magnifyGlass_CrosshairThicknessChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
   MagnifyGlass magnifyGlass = sender as MagnifyGlass;
   Console.WriteLine("CrosshairThickness Changed to " + magnifyGlass.CrosshairThickness.ToString());
}

private void magnifyGlass_BorderBrushChanged(object sender, RoutedPropertyChangedEventArgs<Brush> e)
{
   MagnifyGlass magnifyGlass = sender as MagnifyGlass;
   Console.WriteLine("BorderBrush Changed to " + magnifyGlass.BorderBrush.ToString());
}

private void magnifyGlass_BorderThicknessChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
   MagnifyGlass magnifyGlass = sender as MagnifyGlass;
   Console.WriteLine("BorderThickness Changed to " + magnifyGlass.BorderThickness.ToString());
}

private void magnifyGlass_ShapeChanged(object sender, RoutedPropertyChangedEventArgs<MagnifyGlassShape> e)
{
   MagnifyGlass magnifyGlass = sender as MagnifyGlass;
   Console.WriteLine("Shape Changed to " + magnifyGlass.Shape.ToString());
}

private void magnifyGlass_ScaleFactorChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
   MagnifyGlass magnifyGlass = sender as MagnifyGlass;
   Console.WriteLine("Scale Factor Changed to " + magnifyGlass.ScaleFactor.ToString());
}

private void magnifyGlass_RoundRectangleRadiusChanged(object sender, RoutedPropertyChangedEventArgs<Size> e)
{
   MagnifyGlass magnifyGlass = sender as MagnifyGlass;
   Console.WriteLine("RoundRectangleRadius Changed to " + magnifyGlass.RoundRectangleRadius.ToString());
}

private void magnifyGlass_BackgroundChanged(object sender, RoutedPropertyChangedEventArgs<Brush> e)
{
   MagnifyGlass magnifyGlass = sender as MagnifyGlass;
   Console.WriteLine("Background Changed to " + magnifyGlass.Background.ToString());
}

public void MagnifyGlass_Shape(ImageViewer viewer)
{
   viewer.InteractiveMode = InteractiveMode.MagnifyGlass;
   viewer.MagnifyGlass.CrosshairChanged +=new RoutedPropertyChangedEventHandler<MagnifyGlassCrosshair>(magnifyGlass_CrosshairChanged);
   viewer.MagnifyGlass.CrosshairBrushChanged +=new RoutedPropertyChangedEventHandler<Brush>(magnifyGlass_CrosshairBrushChanged);
   viewer.MagnifyGlass.CrosshairThicknessChanged +=new RoutedPropertyChangedEventHandler<double>(magnifyGlass_CrosshairThicknessChanged);
   viewer.MagnifyGlass.BorderBrushChanged +=new RoutedPropertyChangedEventHandler<Brush>(magnifyGlass_BorderBrushChanged);
   viewer.MagnifyGlass.BorderThicknessChanged +=new RoutedPropertyChangedEventHandler<double>(magnifyGlass_BorderThicknessChanged);
   viewer.MagnifyGlass.ShapeChanged +=new RoutedPropertyChangedEventHandler<MagnifyGlassShape>(magnifyGlass_ShapeChanged);
   viewer.MagnifyGlass.ScaleFactorChanged +=new RoutedPropertyChangedEventHandler<double>(magnifyGlass_ScaleFactorChanged);
   viewer.MagnifyGlass.RoundRectangleRadiusChanged +=new RoutedPropertyChangedEventHandler<Size>(magnifyGlass_RoundRectangleRadiusChanged);
   viewer.MagnifyGlass.BackgroundChanged +=new RoutedPropertyChangedEventHandler<Brush>(magnifyGlass_BackgroundChanged);

   if(viewer.MagnifyGlass.Shape != MagnifyGlassShape.Border3D)
   {
      // 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 = new SolidColorBrush(Colors.Blue);
      viewer.MagnifyGlass.BorderThickness = 10;
      viewer.MagnifyGlass.Crosshair = MagnifyGlassCrosshair.Fine;
      viewer.MagnifyGlass.CrosshairBrush = new SolidColorBrush(Colors.Red);
      viewer.MagnifyGlass.CrosshairThickness = 5;
      viewer.MagnifyGlass.Size = new Size(200, 200);
      viewer.MagnifyGlass.Background = new SolidColorBrush(Colors.Green);

      viewer.MagnifyGlass.ScaleFactor = 1.5f;
   }

   viewer.MagnifyGlass.CrosshairChanged -= new RoutedPropertyChangedEventHandler<MagnifyGlassCrosshair>(magnifyGlass_CrosshairChanged);
   viewer.MagnifyGlass.CrosshairBrushChanged -= new RoutedPropertyChangedEventHandler<Brush>(magnifyGlass_CrosshairBrushChanged);
   viewer.MagnifyGlass.CrosshairThicknessChanged -= new RoutedPropertyChangedEventHandler<double>(magnifyGlass_CrosshairThicknessChanged);
   viewer.MagnifyGlass.BorderBrushChanged -= new RoutedPropertyChangedEventHandler<Brush>(magnifyGlass_BorderBrushChanged);
   viewer.MagnifyGlass.BorderThicknessChanged -= new RoutedPropertyChangedEventHandler<double>(magnifyGlass_BorderThicknessChanged);
   viewer.MagnifyGlass.ShapeChanged -= new RoutedPropertyChangedEventHandler<MagnifyGlassShape>(magnifyGlass_ShapeChanged);
   viewer.MagnifyGlass.ScaleFactorChanged -= new RoutedPropertyChangedEventHandler<double>(magnifyGlass_ScaleFactorChanged);
   viewer.MagnifyGlass.RoundRectangleRadiusChanged -= new RoutedPropertyChangedEventHandler<Size>(magnifyGlass_RoundRectangleRadiusChanged);
   viewer.MagnifyGlass.BackgroundChanged -= new RoutedPropertyChangedEventHandler<Brush>(magnifyGlass_BackgroundChanged);
}
SilverlightVBCopy Code
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 = New SolidColorBrush(Colors.Blue)
      viewer.MagnifyGlass.BorderThickness = 10
      viewer.MagnifyGlass.Crosshair = MagnifyGlassCrosshair.Fine
      viewer.MagnifyGlass.CrosshairBrush = New SolidColorBrush(Colors.Red)
      viewer.MagnifyGlass.CrosshairThickness = 5
      viewer.MagnifyGlass.Size = New Size(200, 200)
      viewer.MagnifyGlass.Background = New SolidColorBrush(Colors.Green)

      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

Remarks

This event is raised if the Shape property is changed by either a programmatic modification or user interaction.

Requirements

Target Platforms: Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family

See Also

Reference

MagnifyGlass Class
MagnifyGlass Members