Reference Guide
GdPicture14.WPF Namespace / GdViewer Class / DisplayFromMemory Method
A pointer to the area of memory, which stores the document data. This pointer must be properly initialized and it must be disposed of by the user as well.
The length of the specified memory area, in bytes.
Example





In This Topic
    DisplayFromMemory Method (GdViewer)
    In This Topic
    Loads a document from a file, which data are stored within a specified memory area and subsequently displays it in the GdViewer control. The document previously displayed in the control will automatically close.

    All document formats currently supported by the toolkit are listed here.

    The BeforeDocumentChange and the AfterDocumentChange events are raised just before and right after the document is displayed in the GdViewer control. Both events are only raised if the document has been successfully loaded.

    Syntax
    'Declaration
     
    
    Public Function DisplayFromMemory( _
       ByVal hMem As IntPtr, _
       ByVal Length As Integer _
    ) As GdPictureStatus
    public GdPictureStatus DisplayFromMemory( 
       IntPtr hMem,
       int Length
    )
    public function DisplayFromMemory( 
        hMem: IntPtr;
        Length: Integer
    ): GdPictureStatus; 
    public function DisplayFromMemory( 
       hMem : IntPtr,
       Length : int
    ) : GdPictureStatus;
    public: GdPictureStatus DisplayFromMemory( 
       IntPtr hMem,
       int Length
    ) 
    public:
    GdPictureStatus DisplayFromMemory( 
       IntPtr hMem,
       int Length
    ) 

    Parameters

    hMem
    A pointer to the area of memory, which stores the document data. This pointer must be properly initialized and it must be disposed of by the user as well.
    Length
    The length of the specified memory area, in bytes.

    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 memory area.
    'We assume that the GdViewer1 control has been properly integrated.
    Dim mem As IntPtr = IntPtr.Zero
    'Initialize the pointer to proper data.
    If GdViewer1.DisplayFromMemory(mem, 1024) = GdPictureStatus.OK Then
        'Do your stuff here.
    Else
        MessageBox.Show("This file can't be displayed. Status: " & GdViewer1.GetStat().ToString(), "GdViewer.DisplayFromMemory")
    End If
    //We assume that the GdViewer1 control has been properly integrated.
    IntPtr mem = IntPtr.Zero;
    //Initialize the pointer to proper data.
    if (GdViewer1.DisplayFromMemory(mem, 1024) == GdPictureStatus.OK)
    {
        //Do your stuff here.
    }
    else
    {
        MessageBox.Show("This file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DisplayFromMemory");
    }
    See Also