Zooms the image to the specified rectangle.
Syntax
Visual Basic (Declaration) | |
---|
Public Overridable Sub ZoomToRectangle( _
ByVal rc As Rect _
) |
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 Basic | Copy 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