DisplayFromGdPictureImage Method (GdViewer)
Loads an image represented by the unique image identifier referring to an associated GdPictureImage object and subsequently displays it in the GdViewer control. The document previously displayed in the control will automatically close.
The GdViewer.BeforeDocumentChange and the GdViewer.AfterDocumentChange events are raised just before and right after the image is displayed in the GdViewer control. Both events are only raised if the image has been successfully loaded.
'Declaration
Public Function DisplayFromGdPictureImage( _
ByVal As Integer _
) As GdPictureStatus
Parameters
- ImageID
- A unique image identifier of the image resource to display, represented by the GdPictureImage object.
You are able to obtain this identifier using methods of the GdPictureImaging class when creating the image resource and you need to release the image resource after being used as well.
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.
How to display your image from an image resource using the GdPictureImaging class.
'We assume that the GdViewer1 control has been properly integrated.
Using image As GdPictureImaging = New GdPictureImaging()
'The File Open dialog box will pop up to select a file.
Dim imageID As Integer = image.CreateGdPictureImageFromFile("")
If image.GetStat() = GdPictureStatus.OK Then
If GdViewer1.DisplayFromGdPictureImage(imageID) = GdPictureStatus.OK Then
'Do your stuff here.
Else
MessageBox.Show("This file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DisplayFromGdPictureImage")
End If
GdViewer1.CloseDocument()
image.ReleaseGdPictureImage(imageID)
Else
MessageBox.Show("The image can't be loaded. Status: " + image.GetStat().ToString(), "GdViewer.DisplayFromGdPictureImage")
End If
End Using
//We assume that the GdViewer1 control has been properly integrated.
using (GdPictureImaging image = new GdPictureImaging())
{
//The File Open dialog box will pop up to select a file.
int imageID = image.CreateGdPictureImageFromFile("");
if (image.GetStat() == GdPictureStatus.OK)
{
if (GdViewer1.DisplayFromGdPictureImage(imageID) == GdPictureStatus.OK)
{
//Do your stuff here.
}
else
{
MessageBox.Show("This file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DisplayFromGdPictureImage");
}
GdViewer1.CloseDocument();
image.ReleaseGdPictureImage(imageID);
}
else
MessageBox.Show("The image can't be loaded. Status: " + image.GetStat().ToString(), "GdViewer.DisplayFromGdPictureImage");
}