GdPicture.NET.14
GdPicture14.WPF Namespace / GdViewer Class / ZoomDocumentArea(Double,Double,Double,Double) Method
The horizontal (left) coordinate of the top-left corner of the required area on the displayed page, in pixels. The origin is set to the top-left corner of the displayed page.
The vertical (top) coordinate of the top-left corner of the required area on the displayed page, in pixels. The origin is set to the top-left corner of the displayed page.
The width of the required area, in pixels.
The height of the required area, in pixels.
Example





ZoomDocumentArea(Double,Double,Double,Double) Method
Adjusts the current zoom to the area covered by the specified rectangle on the current page of the document displayed in the viewer. The viewer control is subsequently refreshed to zoom on the defined area.
Syntax
'Declaration
 
Public Function ZoomDocumentArea( _
   ByVal Left As Double, _
   ByVal Top As Double, _
   ByVal Width As Double, _
   ByVal Height As Double _
) As GdPictureStatus
 

Parameters

Left
The horizontal (left) coordinate of the top-left corner of the required area on the displayed page, in pixels. The origin is set to the top-left corner of the displayed page.
Top
The vertical (top) coordinate of the top-left corner of the required area on the displayed page, in pixels. The origin is set to the top-left corner of the displayed page.
Width
The width of the required area, in pixels.
Height
The height of the required area, in pixels.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK. We strongly recommend always checking this status first.
Remarks
Please note that the ZoomMode property is set to ViewerZoomMode.ZoomModeCustom using this method.

The ZoomChanged event, respectively the PreviewZoomChanged event, is raised using this method.

Example
How to zoom on the specified document area.
'We assume that the GdViewer1 control has been properly integrated.
Private Sub GdViewer1_MouseClick(ByVal sender As Object, ByVal e As MouseEventArgs)
    Dim left As Double = e.GetPosition(Me).X
    Dim top As Double = e.GetPosition(Me).Y
    Dim width As Double = 400, height As Double = 200
    GdViewer1.ZoomDocumentArea(left - width / 2, top - height / 2, width, height)
End Sub
See Also