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 As Integer, _
ByVal As Integer, _
ByVal As Integer, _
ByVal As Integer _
) As GdPictureStatus
public GdPictureStatus CopyRegionToClipboard(
int ,
int ,
int ,
int
)
public function CopyRegionToClipboard(
: Integer;
: Integer;
: Integer;
: Integer
): GdPictureStatus;
public function CopyRegionToClipboard(
: int,
: int,
: int,
: int
) : GdPictureStatus;
public: GdPictureStatus CopyRegionToClipboard(
int ,
int ,
int ,
int
)
public:
GdPictureStatus CopyRegionToClipboard(
int ,
int ,
int ,
int
)
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.
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");
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