Http://blog.csdn.net/cnming/archive/2007/04/21/1574030.aspx
Due to memory release problems, the use of the bitblt method will cause memory usage to grow slowly and will not be released. This problem does not occur when using common dual-buffering, and the speed is acceptable.
Some code is cropped, so the code is incomplete.
Cementing. curvesplit. drawcurvepress and then draw a pressure graph on the bitmap (membmp) pointed to by memdc.
Using system;
Using system. Collections. Generic;
Using system. text;
Using system. runtime. interopservices;
Namespace Cementing
{
Class win32support
{
/// <Summary>
/// Enumeration to be used for those Win32 function that return bool
/// </Summary>
Public Enum bool
{
False = 0,
True
};
/// <Summary>
/// Enumeration for the raster operations used in bitblt.
/// In C ++ these are actually # define. But to use these
/// Constants with C #, a new Enumeration type is defined.
/// </Summary>
Public Enum ternaryrasteroperations
{
Srccopy = 0x00cc0020,/* DEST = source */
Srcpaint = 0x00ee0086,/* DEST = source or DEST */
Srcand = 0x008800c6,/* DEST = source and DEST */
SRCINVERT = 0x00660046,/* DEST = source xor dest */
Srcerase = 0x00440328,/* DEST = source and (not DEST )*/
Notsrccopy = 0x00330008,/* DEST = (not source )*/
NOTSRCERASE = 0x001100a6,/* DEST = (not SRC) and (not DEST )*/
Mergecopy = 0x00c000ca,/* DEST = (source and pattern )*/
Mergepaint = 0x00bb0226,/* DEST = (not source) or DEST */
Patcopy = 0x00f00021,/* DEST = pattern */
Patpaint = 0x00fb0a09,/* DEST = dpsnoo */
Patinvert = 0x005a0049,/* DEST = pattern xor dest */
Dstinvert = 0x00550009,/* DEST = (not DEST )*/
Blackness = 0x00000042,/* DEST = black */
Whiteness = 0x00ff0062,/* DEST = white */
};
/// <Summary>
/// Createcompatibledc
/// </Summary>
[Dllimport ("gdi32.dll", exactspelling = true, setlasterror = true)]
Public static extern intptr createcompatibledc (intptr HDC );
/// <Summary>
/// Deletedc
/// </Summary>
[Dllimport ("gdi32.dll", exactspelling = true, setlasterror = true)]
Public static extern bool deletedc (intptr HDC );
/// <Summary>
/// SelectObject
/// </Summary>
[Dllimport ("gdi32.dll", exactspelling = true)]
Public static extern intptr SelectObject (intptr HDC, intptr hobject );
/// <Summary>
/// Deleteobject
/// </Summary>
[Dllimport ("gdi32.dll", exactspelling = true, setlasterror = true)]
Public static extern bool deleteobject (intptr hobject );
/// <Summary>
/// Createcompatiblebitmap
/// </Summary>
[Dllimport ("gdi32.dll", exactspelling = true, setlasterror = true)]
Public static extern intptr createcompatiblebitmap (intptr hobject, int width, int height );
/// <Summary>
/// Bitblt
/// </Summary>
[Dllimport ("gdi32.dll", exactspelling = true, setlasterror = true)]
Public static extern bool bitblt (intptr hobject, int nxdest, int nydest, int nwidth, int nheight, intptr hobjsource, int nxsrc, int nysrc, ternaryrasteroperations dwrop );
}
}