Occurs when the user performs interactive panning of the image display.
Syntax
XAML Attributes Usage | |
---|
<object InteractivePan=EventHandler<ExceptionRoutedEventArgs>/> ... |
Example
This example changes the mouse cursor when panning,
and displays the contents of the InteractivePan event in the console.
Visual Basic | Copy 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
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); } |
XAML | Copy 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 15\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