A pointer to a Microsoft® Windows® Graphics Device Interface (GDI) BITMAPINFO structure. This pointer must be initialized with the proper image data in the DIB format and it must be disposed of by the user as well.
Example





In This Topic
GdPicture14.WPF Namespace / GdViewer Class / DisplayFromDIB Method

DisplayFromDIB Method (GdViewer)

In This Topic
Loads an image from an instantiated Device Independent Bitmap (DIB) 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 DisplayFromDIB( _

   ByVal Dib As IntPtr _

) As GdPictureStatus
public GdPictureStatus DisplayFromDIB( 

   IntPtr Dib

)
public function DisplayFromDIB( 

    Dib: IntPtr

): GdPictureStatus; 
public function DisplayFromDIB( 

   Dib : IntPtr

) : GdPictureStatus;
public: GdPictureStatus DisplayFromDIB( 

   IntPtr Dib

) 
public:

GdPictureStatus DisplayFromDIB( 

   IntPtr Dib

) 

Parameters

Dib
A pointer to a Microsoft® Windows® Graphics Device Interface (GDI) BITMAPINFO structure. This pointer must be initialized with the proper image data in the DIB format 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 an image from a dib file.
Private Function LoadDIB(ByVal filename As String) As IntPtr

    Dim image As IntPtr = IntPtr.Zero

    Return image

End Function

'We assume that the GdViewer1 control has been properly integrated.

If GdViewer1.DisplayFromDIB(LoadDIB("image.dib")) = GdPictureStatus.OK Then

    'Do your stuff here.

Else

    MessageBox.Show("This image can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DisplayFromDIB")

End If
private IntPtr LoadDIB(string filename)

{

    IntPtr image = IntPtr.Zero;

    //Create or load your DIB image.

    return image;

}

//We assume that the GdViewer1 control has been properly integrated.

if (GdViewer1.DisplayFromDIB(LoadDIB("image.dib")) == GdPictureStatus.OK)

{

    //Do your stuff here.

}

else

{

    MessageBox.Show("This image can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DisplayFromDIB");

}
See Also