Occurs when the user interacts with the center of the image display.
Syntax
XAML Attributes Usage | |
---|
<object InteractiveZoomTo=EventHandler<ExceptionRoutedEventArgs>/> ... |
Example
This example zooms the image when dragging a rectangle on the image.
Also, it displays the contents of the InteractiveZoomTo event in the console.
Visual Basic | Copy Code |
---|
Private Sub viewer_InteractiveZoomTo(ByVal sender As Object, ByVal e As BitmapSourceViewerRectangleEventArgs)
Console.WriteLine("InteractiveZoomTo: e.Rectangle {0}, e.Status {1}, e.Cancel {2}", e.Rectangle, e.Status, e.Cancel)
End Sub
Public Sub BitmapSourceViewer_InteractiveZoomTo(ByVal viewer As BitmapSourceViewer)
viewer.InteractiveMode = BitmapSourceViewerInteractiveMode.ZoomTo
AddHandler viewer.InteractiveZoomTo, AddressOf viewer_InteractiveZoomTo
MessageBox.Show("Draw a rectangle with the mouse to cause a zoom")
End Sub |
C# | Copy Code |
---|
private void viewer_InteractiveZoomTo(object sender, BitmapSourceViewerRectangleEventArgs e) { Console.WriteLine("InteractiveZoomTo: e.Rectangle {0}, e.Status {1}, e.Cancel {2}", e.Rectangle, e.Status, e.Cancel); } public void BitmapSourceViewer_InteractiveZoomTo(BitmapSourceViewer viewer) { viewer.InteractiveMode = BitmapSourceViewerInteractiveMode.ZoomTo; viewer.InteractiveZoomTo += new InteractiveZoomToEventHandler(viewer_InteractiveZoomTo); MessageBox.Show("Draw a rectangle with the mouse to cause a zoom"); // After you are done, you must remove the event handler as in below // // viewer.InteractiveZoomTo -= new BitmapSourceViewer.InteractiveZoomToEventHandler(viewer_InteractiveZoomTo); } |
XAML | Copy Code |
---|
<Window x:Class="WPFSamples.BitmapSourceViewer" Height="600" Width="800" Title="InteractiveZoomTo 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="Center" InteractiveMode="ZoomTo" InteractiveZoomTo="viewer_InteractiveZoomTo" /> </DockPanel> </Window> |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Vista, and Windows Server 2003 family
See Also