A System.Drawing.Bitmap object that contains the image 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 / DisplayFromBitmap Method

DisplayFromBitmap Method

In This Topic
Loads an image data stored in a System.Drawing.Bitmap object 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 DisplayFromBitmap( _
   ByVal bm As Bitmap _
) As GdPictureStatus
public GdPictureStatus DisplayFromBitmap( 
   Bitmap bm
)
public function DisplayFromBitmap( 
    bm: Bitmap
): GdPictureStatus; 
public function DisplayFromBitmap( 
   bm : Bitmap
) : GdPictureStatus;
public: GdPictureStatus DisplayFromBitmap( 
   Bitmap* bm
) 
public:
GdPictureStatus DisplayFromBitmap( 
   Bitmap^ bm
) 

Parameters

bm
A System.Drawing.Bitmap object that contains the image 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 the bitmap.
'We assume that the GdViewer1 control has been properly integrated.
Dim image As System.Drawing.Bitmap = New System.Drawing.Bitmap("image.bmp")
If GdViewer1.DisplayFromBitmap(image) = GdPictureStatus.OK Then
    'Do your stuff here.
    GdViewer1.CloseDocument()
Else
    MessageBox.Show("This file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DisplayFromBitmap")
End If
image.Dispose()
//We assume that the GdViewer1 control has been properly integrated.
System.Drawing.Bitmap image = new System.Drawing.Bitmap("image.bmp");
if (GdViewer1.DisplayFromBitmap(image) == GdPictureStatus.OK)
{
    //Do your stuff here.
    GdViewer1.CloseDocument();
}
else
{
    MessageBox.Show("This file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DisplayFromBitmap");
}
image.Dispose();
See Also