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





Occurs when the user performs interactive panning of the image display.

Syntax

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

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

Routed Event Information 

Identifier field

InteractivePanEvent

Routing strategy

Bubbling

Delegate

InteractivePanEventHandler

XAML Attributes Usage 

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

Routed Event Information 

Identifier field

InteractivePanEvent

Routing strategy

Bubbling

Delegate

InteractivePanEventHandler

Example

This example changes the mouse cursor when panning, and displays the contents of the InteractivePan event in the console.

Visual BasicCopy Code
Private Sub viewer_InteractivePan(ByVal sender As Object, ByVal e As BitmapSourceViewerLineEventArgs)
    Dim viewer As BitmapSourceViewer = CType(IIf(TypeOf sender Is BitmapSourceViewer, sender, Nothing), BitmapSourceViewer)
    If e.Status = BitmapSourceViewerInteractiveStatus.Begin Then
        viewer.Cursor = Cursors.Hand
    ElseIf e.Status = BitmapSourceViewerInteractiveStatus.End Then
        viewer.Cursor = Cursors.Arrow
    End If
    Console.WriteLine("InteractivePan: 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_InteractivePan(ByVal viewer As BitmapSourceViewer)
    AddHandler viewer.InteractivePan, AddressOf viewer_InteractivePan
    viewer.InteractiveMode = BitmapSourceViewerInteractiveMode.Pan

    ' Do the panning

    ' After you are done, you must remove the event handler as in below
    ' viewer.InteractivePan -= new EventHandler<BitmapSourceViewerLineEventArgs>(viewer_InteractivePan);
End Sub
C#Copy Code
private void viewer_InteractivePan(object sender, BitmapSourceViewerLineEventArgs e) 

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

public void BitmapSourceViewer_InteractivePan(BitmapSourceViewer viewer) 

   viewer.InteractivePan += new InteractivePanEventHandler(viewer_InteractivePan); 
   viewer.InteractiveMode = BitmapSourceViewerInteractiveMode.Pan; 
 
   // Do the panning 
 
   // After you are done, you must remove the event handler as in below 
   // viewer.InteractivePan -= new EventHandler<BitmapSourceViewerLineEventArgs>(viewer_InteractivePan); 
}
XAMLCopy Code
<Window x:Class="WPFSamples.BitmapSourceViewer" Height="600" Width="800" Title="InteractivePan 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="Pan" InteractivePan="viewer_InteractivePan" /> 
  </DockPanel> 
</Window>

Remarks

Requirements

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

See Also