Occurs when the user interacts with the center of the image display.
Syntax
XAML Attributes Usage | |
---|
<object InteractiveCenterAt=EventHandler<ExceptionRoutedEventArgs>/> ... |
Example
This example lets the user center the image in the window by clicking the mouse.
Also, it displays the contents of the InteractiveCenterAt event in the console.
Visual Basic | Copy Code |
---|
Private Sub viewer_InteractiveCenterAt(ByVal sender As Object, ByVal e As BitmapSourceViewerPointEventArgs)
Console.WriteLine("InteractiveCenterAt: e.Status {0}, e.Cancel {1}", e.Status, e.Cancel)
End Sub
Public Sub BitmapSourceViewer_InteractiveCenterAt(ByVal viewer As BitmapSourceViewer)
viewer.InteractiveMode = BitmapSourceViewerInteractiveMode.CenterAt
AddHandler viewer.InteractiveCenterAt, AddressOf viewer_InteractiveCenterAt
End Sub |
C# | Copy Code |
---|
private void viewer_InteractiveCenterAt(object sender, BitmapSourceViewerPointEventArgs e) { Console.WriteLine("InteractiveCenterAt: e.Status {0}, e.Cancel {1}", e.Status, e.Cancel); } public void BitmapSourceViewer_InteractiveCenterAt(BitmapSourceViewer viewer) { viewer.InteractiveMode = BitmapSourceViewerInteractiveMode.CenterAt; viewer.InteractiveCenterAt += new InteractiveCenterAtEventHandler(viewer_InteractiveCenterAt); // Click mouse on image to see the center the image // After you are done, you must remove the event handler as in below // // viewer.InteractiveCenterAt -= new BitmapSourceViewer.InteractiveCenterAtEventHandler(viewer_InteractiveCenterAt); } |
XAML | Copy Code |
---|
<Window x:Class="WPFSamples.BitmapSourceViewer" Height="600" Width="800" Title="InteractiveCenterAt 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="CenterAt" InteractiveCenterAt="viewer_InteractiveCenterAt" /> </DockPanel> </Window> |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Vista, and Windows Server 2003 family
See Also