←Select platform

ZoomToRectangle Method

Summary

Zooms the image to the specified rectangle.

Syntax

C#
VB
C++
public virtual void ZoomToRectangle( 
   Rect rc 
) 
  
Public Overridable Sub ZoomToRectangle( _ 
   ByVal rc As Rect _ 
)  
public: 
virtual void ZoomToRectangle(  
   Rect rc 
)  

Parameters

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

Remarks

The control will call this method during InteractiveMode.ZoomTo.

Example

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

C#
VB
Silverlight C#
Silverlight VB
using Leadtools.Help; 
using Leadtools.Windows.Controls; 
 
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); 
} 
Imports Leadtools.Windows.Controls 
 
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 
using Leadtools.Help; 
using Leadtools.Windows.Controls; 
 
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); 
} 
Imports Leadtools 
Imports Leadtools.Windows.Controls 
 
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 

Requirements

Target Platforms

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Windows.Controls Assembly