LEADTOOLS WPF and Silverlight (Leadtools.Windows.Controls assembly)
LEAD Technologies, Inc

InteractiveMode Property

Example 





Gets or sets a value that indicates the current user interaction mode with the control's display. This is a dependency property. .NET support Silverlight support
Syntax
public InteractiveMode InteractiveMode {get; set;}
'Declaration
 
Public Property InteractiveMode As InteractiveMode
'Usage
 
Dim instance As ImageViewer
Dim value As InteractiveMode
 
instance.InteractiveMode = value
 
value = instance.InteractiveMode
public InteractiveMode InteractiveMode {get; set;}
 get_InteractiveMode();
set_InteractiveMode(value);
public:
property InteractiveMode InteractiveMode {
   InteractiveMode get();
   void set (    InteractiveMode value);
}

Property Value

An InteractiveMode enumeration member that indicates the current user interaction mode with the control's display. Default value is InteractiveMode.None.
Remarks

You can change the mouse cursor associated with a particular interactive mode with the SetInteractiveModeCursor method. For descriptions of the various interactive mode available, refer to InteractiveMode.

Example
Copy CodeCopy Code  
Private Sub viewer_InteractiveModeChanged(ByVal sender As Object, ByVal e As RoutedEventArgs)
    Dim viewer As ImageViewer = TryCast(sender, ImageViewer)
    Dim s As String = String.Format("InteractiveMode changed to: {0}", viewer.InteractiveMode.ToString())
    MessageBox.Show(s)
End Sub
Public Sub BitmapSourceViewer_InteractiveMode(ByVal viewer As ImageViewer)
    AddHandler viewer.InteractiveModeChanged, AddressOf viewer_InteractiveModeChanged
    AddHandler viewer.InteractivePan, AddressOf viewer_InteractivePan

    Select Case viewer.InteractiveMode
        Case InteractiveMode.None
            viewer.InteractiveMode = InteractiveMode.Pan

        Case InteractiveMode.Pan
            viewer.InteractiveMode = InteractiveMode.MagnifyGlass

        Case InteractiveMode.MagnifyGlass
            viewer.InteractiveMode = InteractiveMode.ZoomTo

        Case InteractiveMode.ZoomTo
            viewer.InteractiveMode = InteractiveMode.None
    End Select

    RemoveHandler viewer.InteractiveModeChanged, AddressOf viewer_InteractiveModeChanged
End Sub
private void viewer_InteractiveModeChanged(object sender, RoutedEventArgs e)
{
   ImageViewer viewer = sender as ImageViewer;
   string s = string.Format("InteractiveMode changed to: {0}", viewer.InteractiveMode.ToString());
   MessageBox.Show(s);
}
public void BitmapSourceViewer_InteractiveMode(ImageViewer viewer)
{
   viewer.InteractiveModeChanged += new RoutedPropertyChangedEventHandler<InteractiveMode>(viewer_InteractiveModeChanged);
   viewer.InteractivePan +=new EventHandler<LineInteractiveEventArgs>(viewer_InteractivePan);

   switch(viewer.InteractiveMode)
   {
      case InteractiveMode.None:
         viewer.InteractiveMode = InteractiveMode.Pan;
         break;

      case InteractiveMode.Pan:
         viewer.InteractiveMode = InteractiveMode.MagnifyGlass;
         break;

      case InteractiveMode.MagnifyGlass:
         viewer.InteractiveMode = InteractiveMode.ZoomTo;
         break;

      case InteractiveMode.ZoomTo:
         viewer.InteractiveMode = InteractiveMode.None;
         break;
   }

   viewer.InteractiveModeChanged -= new RoutedPropertyChangedEventHandler<InteractiveMode>(viewer_InteractiveModeChanged);
}
private void viewer_InteractiveModeChanged(object sender, RoutedEventArgs e)
{
   ImageViewer viewer = sender as ImageViewer;
   string s = string.Format("InteractiveMode changed to: {0}", viewer.InteractiveMode.ToString());
   MessageBox.Show(s);
}
public void BitmapSourceViewer_InteractiveMode(ImageViewer viewer)
{
   viewer.InteractiveModeChanged += new RoutedPropertyChangedEventHandler<InteractiveMode>(viewer_InteractiveModeChanged);
   viewer.InteractivePan +=new EventHandler<LineInteractiveEventArgs>(viewer_InteractivePan);

   switch(viewer.InteractiveMode)
   {
      case InteractiveMode.None:
         viewer.InteractiveMode = InteractiveMode.Pan;
         break;

      case InteractiveMode.Pan:
         viewer.InteractiveMode = InteractiveMode.MagnifyGlass;
         break;

      case InteractiveMode.MagnifyGlass:
         viewer.InteractiveMode = InteractiveMode.ZoomTo;
         break;

      case InteractiveMode.ZoomTo:
         viewer.InteractiveMode = InteractiveMode.None;
         break;
   }

   viewer.InteractiveModeChanged -= new RoutedPropertyChangedEventHandler<InteractiveMode>(viewer_InteractiveModeChanged);
}
Private Sub viewer_InteractiveModeChanged(ByVal sender As Object, ByVal e As RoutedEventArgs)
   Dim viewer As ImageViewer = TryCast(sender, ImageViewer)
   Dim s As String = String.Format("InteractiveMode changed to: {0}", viewer.InteractiveMode.ToString())
   MessageBox.Show(s)
End Sub
Public Sub BitmapSourceViewer_InteractiveMode(ByVal viewer As ImageViewer)
   AddHandler viewer.InteractiveModeChanged, AddressOf viewer_InteractiveModeChanged
   AddHandler viewer.InteractivePan, AddressOf viewer_InteractivePan

   Select Case viewer.InteractiveMode
      Case InteractiveMode.None
         viewer.InteractiveMode = InteractiveMode.Pan

      Case InteractiveMode.Pan
         viewer.InteractiveMode = InteractiveMode.MagnifyGlass

      Case InteractiveMode.MagnifyGlass
         viewer.InteractiveMode = InteractiveMode.ZoomTo

      Case InteractiveMode.ZoomTo
         viewer.InteractiveMode = InteractiveMode.None
   End Select

   RemoveHandler viewer.InteractiveModeChanged, AddressOf viewer_InteractiveModeChanged
End Sub
<Window x:Class="WPFSamples.ImageViewer"
  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"
  Height="600" Width="800" Title="InteractiveMode Sample">
  <DockPanel>
    <Leadtools_Windows_Controls:ImageViewer
      Name="theViewer"
      Source="file:///c:\users\Public\Documents\LEADTOOLS Images\cannon.jpg"
      DockPanel.Dock= "Bottom"
      HorizontalAlignment="Center" VerticalAlignment="Center"
      InteractiveMode="Scale"
      InteractiveModeChanged ="theViewer_InteractiveModeChanged"/>
  </DockPanel>
</Window>
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

ImageViewer Class
ImageViewer Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.