Navigation:  DPLOTLIB Functions >

DPlot_GetBitmap function

Print this Topic Previous pageReturn to chapter overviewNext page

HBITMAP DPlot_GetBitmap(int DocNum, int cx, int cy);

Parameters

DocNum

Document index for the document that you want a bitmap picture of (1-32). In practice this will generally (though not necessarily) be the return value of a call to DPlot_Plot.

cx, cy

Requested width and height of the bitmap, in pixels.

Return Values

0

Generic error attempting to communicate with DPlot. This most often indicates that DPlot is currently busy, e.g. a modal dialog box is open.

<>0

Handle to a device-dependent bitmap. This picture may be drawn in your application with the Windows API functions BitBlt and/or StretchBlt or, with an SS_BITMAP-style frame, with an STM_SETIMAGE message. Although these functions can also work in .NET applications, it is much easier to convert the Win32 bitmap handle to a GDI bitmap and use .NET's features:

 

Bitmap myBmp;

hbmp = dplot.DPlot_GetBitmapEx(DocNum, cx, cy);

myBmp = Bitmap.FromHbitmap(hbmp);

DeleteObject(hbmp);

pictureBox1.Image = myBmp;

Remarks

Palette information is not returned, so this function does not work particularly well with 256 (or fewer) color displays.

 

Example usage in demo programs:

Visual Basic 6:

\btest\btest2

Visual C 5/6:

\c\msvc\ctest2

Visual Basic .NET:

\vbnet\Project2.NET

Visual C#:

\csharp\test2

 

 


Page url: http://www.dplot.com/lib/index.htm?dplot_getbitmap.htm