A pointer to a Microsoft® Windows® Graphics Device Interface (GDI). This pointer 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 / DisplayFromHBitmap Method

DisplayFromHBitmap Method (GdViewer)

In This Topic
Loads an image from an instantiated Microsoft® Windows® Graphics Device Interface (GDI) handle and then displays it 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 DisplayFromHBitmap( _
   ByVal Hbitmap As IntPtr _
) As GdPictureStatus
public GdPictureStatus DisplayFromHBitmap( 
   IntPtr Hbitmap
)
public function DisplayFromHBitmap( 
    Hbitmap: IntPtr
): GdPictureStatus; 
public function DisplayFromHBitmap( 
   Hbitmap : IntPtr
) : GdPictureStatus;
public: GdPictureStatus DisplayFromHBitmap( 
   IntPtr Hbitmap
) 
public:
GdPictureStatus DisplayFromHBitmap( 
   IntPtr Hbitmap
) 

Parameters

Hbitmap
A pointer to a Microsoft® Windows® Graphics Device Interface (GDI). This pointer 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 HBitmap.
'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.DisplayFromHBitmap(image) = GdPictureStatus.OK Then
    'Do your stuff here.
Else
    MessageBox.Show("This file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DisplayFromHBitmap")
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.DisplayFromHBitmap(image) == GdPictureStatus.OK)
{
    //Do your stuff here.
}
else
{
    MessageBox.Show("This file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DisplayFromHBitmap");
}
See Also