Output parameter. The horizontal (X) coordinate (0-based) of the top left point, in pixels, of the document's area visible in the control.
Output parameter. The vertical (Y) coordinate (0-based) of the top left point, in pixels, of the document's area visible in the control.
Output parameter. The width, in pixels, of the visible area rectangle.
Output parameter. The height, in pixels, of the visible area rectangle.
Example





In This Topic
GdPicture14.WPF Namespace / GdViewer Class / GetDisplayedArea Method

GetDisplayedArea Method (GdViewer)

In This Topic
Returns coordinates and dimensions, in pixels, of the document's visible area within the control. The resulting rectangle relates to the current page of the document displayed in the GdViewer control and the coordinates correspond to the actual document pages area of the currently displayed page.
Syntax
'Declaration
 
Public Sub GetDisplayedArea( _
   ByRef Left As Double, _
   ByRef Top As Double, _
   ByRef Width As Double, _
   ByRef Height As Double _
) 
public void GetDisplayedArea( 
   ref double Left,
   ref double Top,
   ref double Width,
   ref double Height
)
public procedure GetDisplayedArea( 
   var  Left: Double;
   var  Top: Double;
   var  Width: Double;
   var  Height: Double
); 
public function GetDisplayedArea( 
   Left : double,
   Top : double,
   Width : double,
   Height : double
);
public: void GetDisplayedArea( 
   ref double Left,
   ref double Top,
   ref double Width,
   ref double Height
) 
public:
void GetDisplayedArea( 
   double% Left,
   double% Top,
   double% Width,
   double% Height
) 

Parameters

Left
Output parameter. The horizontal (X) coordinate (0-based) of the top left point, in pixels, of the document's area visible in the control.
Top
Output parameter. The vertical (Y) coordinate (0-based) of the top left point, in pixels, of the document's area visible in the control.
Width
Output parameter. The width, in pixels, of the visible area rectangle.
Height
Output parameter. The height, in pixels, of the visible area rectangle.
Remarks
You can regularly apply the GetStat method to determine if this method has been successful.

Just to remind you, that all coordinates are 0-based with the origin being in the top left corner in the document pages area and they are related to the current page determined by the CurrentPage property.

Example
How to copy the content of the visible area to the clipboard.
'We assume that the GdViewer1 control has been properly integrated.
If GdViewer1.DisplayFromFile("") = GdPictureStatus.OK Then
    Dim left As Double = 0, top As Double = 0, width As Double = 0, height As Double = 0
    GdViewer1.GetDisplayedArea(left, top, width, height)
    If GdViewer1.CopyRegionToClipboard(CInt(left), CInt(top), CInt(width), CInt(height)) = GdPictureStatus.OK Then
        MessageBox.Show("Done!", "GdViewer.GetDisplayedArea")
    Else
        MessageBox.Show("The page content can't be copied. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetDisplayedArea")
    End If
Else
    MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetDisplayedArea")
End If
//We assume that the GdViewer1 control has been properly integrated.
if (GdViewer1.DisplayFromFile("") == GdPictureStatus.OK)
{
    double left = 0, top = 0, width = 0, height = 0;
    GdViewer1.GetDisplayedArea(ref left, ref top, ref width, ref height);
    if (GdViewer1.CopyRegionToClipboard((int)left, (int)top, (int)width, (int)height) == GdPictureStatus.OK)
    {
        MessageBox.Show("Done!", "GdViewer.GetDisplayedArea");
    }
    else MessageBox.Show("The page content can't be copied. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetDisplayedArea");
}
else
    MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetDisplayedArea");
See Also