A System.Windows.Media.Imaging.BitmapSource 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.WPF Namespace / GdViewer Class / DisplayFromBitmapSource Method

DisplayFromBitmapSource Method

In This Topic
Loads an image data stored in a System.Windows.Media.Imaging.BitmapSource 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 DisplayFromBitmapSource( _
   ByVal BitmapSource As BitmapSource _
) As GdPictureStatus
public GdPictureStatus DisplayFromBitmapSource( 
   BitmapSource BitmapSource
)
public function DisplayFromBitmapSource( 
    BitmapSource: BitmapSource
): GdPictureStatus; 
public function DisplayFromBitmapSource( 
   BitmapSource : BitmapSource
) : GdPictureStatus;
public: GdPictureStatus DisplayFromBitmapSource( 
   BitmapSource* BitmapSource
) 
public:
GdPictureStatus DisplayFromBitmapSource( 
   BitmapSource^ BitmapSource
) 

Parameters

BitmapSource
A System.Windows.Media.Imaging.BitmapSource 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.
'Initialize the BitmapSource object named bitmap.
If GdViewer1.DisplayFromBitmapSource(bitmap) = GdPictureStatus.OK Then
    'Do your stuff here.
    GdViewer1.CloseDocument()
Else
    MessageBox.Show("This image can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DisplayFromBitmapSource")
End If
//We assume that the GdViewer1 control has been properly integrated.
//Initialize the BitmapSource object named bitmap.
if (GdViewer1.DisplayFromBitmapSource(bitmap) == GdPictureStatus.OK)
{
    //Do your stuff here.
    GdViewer1.CloseDocument();
}
else
{
    MessageBox.Show("This image can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DisplayFromBitmapSource");
}
See Also