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.
Example





In This Topic
GdPicture14 Namespace / GdViewer Class / DisplayFromHICON Method

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
'Declaration
 
Public Function DisplayFromHICON( _
   ByVal HICON As IntPtr _
) As GdPictureStatus
public GdPictureStatus DisplayFromHICON( 
   IntPtr HICON
)
public function DisplayFromHICON( 
    HICON: IntPtr
): GdPictureStatus; 
public function DisplayFromHICON( 
   HICON : IntPtr
) : GdPictureStatus;
public: GdPictureStatus DisplayFromHICON( 
   IntPtr HICON
) 
public:
GdPictureStatus DisplayFromHICON( 
   IntPtr HICON
) 

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.
Remarks
Just to remind you that both the BeforeDocumentChange and the AfterDocumentChange events are raised using this method.
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