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





Occurs when the user performs an interactive change of the current scaling factor using the mouse.

Syntax

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

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

Routed Event Information 

Identifier field

InteractiveScaleEvent

Routing strategy

Bubbling

Delegate

InteractiveScaleEventHandler

XAML Attributes Usage 

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

Routed Event Information 

Identifier field

InteractiveScaleEvent

Routing strategy

Bubbling

Delegate

InteractiveScaleEventHandler

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 BasicCopy 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

    ' 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);
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); 
}
XAMLCopy 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 16\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