Leadtools.Windows.Controls Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.03.25
ZoomToRectangle Method
See Also  Example
Leadtools.Windows.Controls Namespace > BitmapSourceViewer Class : ZoomToRectangle Method




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

Syntax

Visual Basic (Declaration) 
Public Overridable Sub ZoomToRectangle( _
   ByVal rc As Rect _
) 
Visual Basic (Usage)Copy Code
Dim instance As BitmapSourceViewer
Dim rc As Rect
 
instance.ZoomToRectangle(rc)
C# 
public virtual void ZoomToRectangle( 
   Rect rc
)
Managed Extensions for 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 BitmapSourceViewer)
   Dim rectSize As Double = 200
   Dim left As Double = (viewer.PhysicalViewRectangle.Right - viewer.PhysicalViewRectangle.Left - rectSize) / 2.0
   Dim top As Double = (viewer.PhysicalViewRectangle.Bottom - viewer.PhysicalViewRectangle.Top - 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(BitmapSourceViewer viewer) 

   double rectSize = 200; 
   double left = (viewer.PhysicalViewRectangle.Right - viewer.PhysicalViewRectangle.Left - rectSize) / 2.0; 
   double top = (viewer.PhysicalViewRectangle.Bottom - viewer.PhysicalViewRectangle.Top - rectSize) / 2.0; 
   Rect rcZoom = new Rect(left, top, rectSize, rectSize); 
   viewer.ZoomToRectangle(rcZoom); 
}

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Vista, and Windows Server 2003 family

See Also