GdPicture.NET.14
GdPicture14 Namespace / GdPictureImaging Class / CreateGdPictureImageFromClipboard Method
Example





In This Topic
CreateGdPictureImageFromClipboard Method (GdPictureImaging)
In This Topic
Creates a new native GdPicture image from the clipboard content. The newly created image is identified by its unique non-zero image identifier.

Please note that it is your responsibility to release the image resources once you have no use for them.

Syntax
'Declaration
 
Public Function CreateGdPictureImageFromClipboard() As Integer
public int CreateGdPictureImageFromClipboard()
public function CreateGdPictureImageFromClipboard(): Integer; 
public function CreateGdPictureImageFromClipboard() : int;
public: int CreateGdPictureImageFromClipboard(); 
public:
int CreateGdPictureImageFromClipboard(); 

Return Value

A unique image identifier of the GdPicture image representing the newly created image. The returned value is non-zero if the image is successfully created. Please first of all use the GetStat method to determine if this method has been successful.

Be aware that you need to release the image with the ReleaseGdPictureImage method after being used.

Remarks
It is recommend to use the GetStat method to identify the specific reason for the method's failure, if any.

Just to inform you, that this method uses the Clipboard class of the .NET Framework.

This method requires the Image Documents component to run.

Example
Creating a new image from a specified area of an existing image using clipboard.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    int imageID1 = gdpictureImaging.CreateGdPictureImageFromFile("");
    // Copy the specified region of an image to clipboard.
    gdpictureImaging.CopyRegionToClipboard(imageID1, 50, 50, 100, 250);
    // Create a new image from clipboard data.
    int imageID2 = gdpictureImaging.CreateGdPictureImageFromClipboard();
    // Process newly created image.
    gdpictureImaging.FxSepia(imageID2);
    gdpictureImaging.SaveAsPNG(imageID2, "image.png");
    // Release used resources.
    gdpictureImaging.DeleteClipboardData();
    gdpictureImaging.ReleaseGdPictureImage(imageID1);
    gdpictureImaging.ReleaseGdPictureImage(imageID2);
}
See Also