Occurs when the user performs an interactive change of the current scaling factor using the mouse.
Syntax
XAML Attributes Usage | |
---|
<object InteractiveScale=EventHandler<ExceptionRoutedEventArgs>/> ... |
Example
This example lets you drag the mouse to scale an image.
Also, it displays the contents of the InteractiveScale event in the console.
Visual Basic | Copy Code |
---|
Private Sub viewer_InteractiveScale(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.SizeAll
ElseIf e.Status = BitmapSourceViewerInteractiveStatus.End Then
viewer.Cursor = Cursors.Arrow
End If
Console.WriteLine("InteractiveScale: 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_InteractiveScale(ByVal viewer As BitmapSourceViewer)
viewer.InteractiveMode = BitmapSourceViewerInteractiveMode.Scale
AddHandler viewer.InteractiveScale, AddressOf viewer_InteractiveScale
End Sub |
C# | Copy Code |
---|
private void viewer_InteractiveScale(object sender, BitmapSourceViewerLineEventArgs e) { BitmapSourceViewer viewer = sender as BitmapSourceViewer; if(e.Status == BitmapSourceViewerInteractiveStatus.Begin) viewer.Cursor = Cursors.SizeAll; else if(e.Status == BitmapSourceViewerInteractiveStatus.End) viewer.Cursor = Cursors.Arrow; Console.WriteLine("InteractiveScale: e.Begin {0}, e.End{1}, e.Status {2}, e.Cancel {3}", e.Begin, e.End, e.Status, e.Cancel); } public void BitmapSourceViewer_InteractiveScale(BitmapSourceViewer viewer) { viewer.InteractiveMode = BitmapSourceViewerInteractiveMode.Scale; viewer.InteractiveScale += new InteractiveScaleEventHandler(viewer_InteractiveScale); // Drag mouse across image to scale the image // After you are done, you must remove the event handler as in below // // viewer.InteractiveScale -= new BitmapSourceViewer.InteractiveScaleEventHandler(viewer_InteractiveScale); } |
XAML | Copy Code |
---|
<Window x:Class="WPFSamples.BitmapSourceViewer" Height="600" Width="800" Title="InteractiveScale 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="Scale" InteractiveScale="viewer_InteractiveScale" /> </DockPanel> </Window> |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Vista, and Windows Server 2003 family
See Also