GdPicture.NET.14
GdPicture14 Namespace / GdViewer Class / ZoomArea 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





In This Topic
ZoomArea Method (GdViewer)
In This Topic
Adjusts the current zoom to the area covered by the specified rectangle on the current page of the document displayed in the GdViewer control. The control is subsequently refreshed to zoom on the defined area.

You can try the Document Viewer Sample here to find out, how to utilize zooming features in your application.

Syntax
'Declaration
 
Public Function ZoomArea( _
   ByVal Left As Integer, _
   ByVal Top As Integer, _
   ByVal Width As Integer, _
   ByVal Height As Integer _
) As GdPictureStatus
public GdPictureStatus ZoomArea( 
   int Left,
   int Top,
   int Width,
   int Height
)
public function ZoomArea( 
    Left: Integer;
    Top: Integer;
    Width: Integer;
    Height: Integer
): GdPictureStatus; 
public function ZoomArea( 
   Left : int,
   Top : int,
   Width : int,
   Height : int
) : GdPictureStatus;
public: GdPictureStatus ZoomArea( 
   int Left,
   int Top,
   int Width,
   int Height
) 
public:
GdPictureStatus ZoomArea( 
   int Left,
   int Top,
   int Width,
   int Height
) 

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.

Both the BeforeZoomChange and the AfterZoomChange events are raised using this method.

Example
How to zoom on the specified document area.
'We assume that the GdViewer1 control has been properly integrated.
Sub GdViewer1_MouseClick(ByVal sender As Object, ByVal e As MouseEventArgs)
    Dim left As Integer = GdViewer1.GetMouseLeftInDocument()
    Dim top As Integer = GdViewer1.GetMouseTopInDocument()
    Dim width As Integer = 400, height As Integer = 200
    GdViewer1.ZoomArea(left - width / 2, top - height / 2, width, height)
End Sub
//We assume that the GdViewer1 control has been properly integrated.
void GdViewer1_MouseClick(object sender, MouseEventArgs e)
{
    int left = GdViewer1.GetMouseLeftInDocument();
    int top = GdViewer1.GetMouseTopInDocument();
    int width = 400, height = 200;
    GdViewer1.ZoomArea(left - width/2, top - height/2, width, height);
}
See Also