LEADTOOLS WPF and Silverlight (Leadtools.Windows.Controls assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.30
ZoomToRectangle Method
See Also 
Leadtools.Windows.Controls Namespace > ImageViewer Class : ZoomToRectangle Method



rc
The rectangle to which the image should be zoomed, in client coordinates.
rc
The rectangle to which the image should be zoomed, in client coordinates.
Zooms the image to the specified rectangle. Supported in Silverlight, Windows Phone 7

Syntax

Visual Basic (Declaration) 
Public Overridable Sub ZoomToRectangle( _
   ByVal rc As Rect _
) 
Visual Basic (Usage)Copy Code
Dim instance As ImageViewer
Dim rc As Rect
 
instance.ZoomToRectangle(rc)
C# 
public virtual void ZoomToRectangle( 
   Rect rc
)
C++/CLI 
public:
virtual void ZoomToRectangle( 
   Rect rc
) 

Parameters

rc
The rectangle to which the image should be zoomed, in client coordinates.

Example

This example zooms to a 200x200 square in the center of the image.

Visual BasicCopy Code
Public Sub BitmapSourceViewer_ZoomToRectangle(ByVal viewer As ImageViewer)
    Dim rectSize As Double = 200
    Dim left As Double = (viewer.PhysicalSize.Width - rectSize) / 2.0
    Dim top As Double = (viewer.PhysicalSize.Height - rectSize) / 2.0
    Dim rcZoom As Rect = New Rect(left, top, rectSize, rectSize)
    viewer.ZoomToRectangle(rcZoom)
End Sub
C#Copy Code
public void BitmapSourceViewer_ZoomToRectangle(ImageViewer viewer)
{
   double rectSize = 200;
   double left = (viewer.PhysicalSize.Width - rectSize) / 2.0;
   double top = (viewer.PhysicalSize.Height - rectSize) / 2.0;
   Rect rcZoom = new Rect(left, top, rectSize, rectSize);
   viewer.ZoomToRectangle(rcZoom);
}
SilverlightCSharpCopy Code
public void BitmapSourceViewer_ZoomToRectangle(ImageViewer viewer)
{
   double rectSize = 200;
   double left = (viewer.PhysicalSize.Width - rectSize) / 2.0;
   double top = (viewer.PhysicalSize.Height - rectSize) / 2.0;
   Rect rcZoom = new Rect(left, top, rectSize, rectSize);
   viewer.ZoomToRectangle(rcZoom);
}
SilverlightVBCopy Code
Public Sub BitmapSourceViewer_ZoomToRectangle(ByVal viewer As ImageViewer)
   Dim rectSize As Double = 200
   Dim left As Double = (viewer.PhysicalSize.Width - rectSize) / 2.0
   Dim top As Double = (viewer.PhysicalSize.Height - rectSize) / 2.0
   Dim rcZoom As Rect = New Rect(left, top, rectSize, rectSize)
   viewer.ZoomToRectangle(rcZoom)
End Sub

Remarks

The control will call this method during InteractiveMode.ZoomTo.

Requirements

Target Platforms: Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family

See Also