DisplayFromHICON Method (GdViewer)
In This Topic
Loads an image of an icon from an instantiated Windows handle to icon and subsequently displays the image in the GdViewer control. The document previously displayed in the control will automatically close.
The BeforeDocumentChange and the 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.
Syntax
Parameters
- HICON
- A Windows handle to an icon to display.
This object must be initialized with the proper image data and it must be disposed of by the user 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.
Example
How to display your image from a handle to HICON.
'We assume that the GdViewer1 control has been properly integrated.
Dim image As IntPtr = IntPtr.Zero
'Initialize the image pointer to proper data.
If GdViewer1.DisplayFromHICON(image) = GdPictureStatus.OK Then
'Do your stuff here.
Else
MessageBox.Show("This image can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DisplayFromHICON")
End If
//We assume that the GdViewer1 control has been properly integrated.
IntPtr image = IntPtr.Zero;
//Initialize the image pointer to proper data.
if (GdViewer1.DisplayFromHICON(image) == GdPictureStatus.OK)
{
//Do your stuff here.
}
else
{
MessageBox.Show("This image can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DisplayFromHICON");
}
Example
How to display your image from a handle to HICON.
'We assume that the GdViewer1 control has been properly integrated.
Dim image As IntPtr = IntPtr.Zero
'Initialize the image pointer to proper data.
If GdViewer1.DisplayFromHICON(image) = GdPictureStatus.OK Then
'Do your stuff here.
Else
MessageBox.Show("This image can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DisplayFromHICON")
End If
//We assume that the GdViewer1 control has been properly integrated.
IntPtr image = IntPtr.Zero;
//Initialize the image pointer to proper data.
if (GdViewer1.DisplayFromHICON(image) == GdPictureStatus.OK)
{
//Do your stuff here.
}
else
{
MessageBox.Show("This image can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DisplayFromHICON");
}
See Also