GdPicture.NET.14
GdPicture14 Namespace / GdViewer Class / CopyRegionToClipboard Method
The horizontal (X) coordinate (0-based) of the top left point, in pixels, of the copied region's rectangle, related to the current page.
The vertical (Y) coordinate (0-based) of the top left point, in pixels, of the copied region's rectangle, related to the current page.
The width, in pixels, of the region's rectangle.
The height, in pixels, of the region's rectangle.
Example





In This Topic
CopyRegionToClipboard Method (GdViewer)
In This Topic
Copies the content of the specified region, related to the current page of the document displayed in the GdViewer control, into the clipboard as an image. Please ensure, that specified coordinates and dimensions correspond to the actual document pages area of the currently displayed page.
Syntax
'Declaration
 
Public Function CopyRegionToClipboard( _
   ByVal SrcLeft As Integer, _
   ByVal SrcTop As Integer, _
   ByVal Width As Integer, _
   ByVal Height As Integer _
) As GdPictureStatus
public GdPictureStatus CopyRegionToClipboard( 
   int SrcLeft,
   int SrcTop,
   int Width,
   int Height
)
public function CopyRegionToClipboard( 
    SrcLeft: Integer;
    SrcTop: Integer;
    Width: Integer;
    Height: Integer
): GdPictureStatus; 
public function CopyRegionToClipboard( 
   SrcLeft : int,
   SrcTop : int,
   Width : int,
   Height : int
) : GdPictureStatus;
public: GdPictureStatus CopyRegionToClipboard( 
   int SrcLeft,
   int SrcTop,
   int Width,
   int Height
) 
public:
GdPictureStatus CopyRegionToClipboard( 
   int SrcLeft,
   int SrcTop,
   int Width,
   int Height
) 

Parameters

SrcLeft
The horizontal (X) coordinate (0-based) of the top left point, in pixels, of the copied region's rectangle, related to the current page.
SrcTop
The vertical (Y) coordinate (0-based) of the top left point, in pixels, of the copied region's rectangle, related to the current page.
Width
The width, in pixels, of the region's rectangle.
Height
The height, in pixels, of the region's rectangle.

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
This method expects to have a core GdPicture license to be unlocked.

Be aware that the required region, even if it is a text-based, is copied into the clipboard as an image.

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