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
Parameters
- Dib
- A pointer to a Microsoft® Windows® Device Independent Bitmap (DIB) handle.
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.
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");
}
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