publicenumTernaryRasterOperations{
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*/};[DllImport("gdi32.dll")]publicstaticexternIntPtrCreateCompatibleBitmap(IntPtr hdc,// handle to DCint nWidth,// width of bitmap, in pixelsint nHeight // height of bitmap, in pixels);[DllImport("gdi32.dll")]publicstaticexternIntPtrCreateCompatibleDC(
IntPtr hdc // handle to DC);[DllImport("gdi32.dll")]publicstaticexternIntPtrSelectObject(IntPtr hdc,// handle to DC
IntPtr hgdiobj // handle to object);[DllImport("gdi32.dll")]publicstaticexternintDeleteDC(
IntPtr hdc // handle to DC);[DllImport("gdi32.dll")]publicstaticexternIntPtrCreateDC(string driver,string device,IntPtr res1,IntPtr res2);[DllImport("gdi32.dll")]publicstaticexternboolBitBlt(IntPtr hObject,int nXDest,int nYDest,int nWidth,int nHeight,IntPtr hObjSource,int nXSrc,int nYSrc,TernaryRasterOperations dwRop);[DllImport("user32.dll")]publicstaticexternboolPrintWindow(IntPtr hwnd,// Window to copy,Handle to the window that will be copied. IntPtr hdcBlt,// HDC to print into,Handle to the device context.
UInt32 nFlags // Optional flags,Specifies the drawing options. It can be one of the following values. );[DllImport("user32.dll")]publicstaticexternIntPtrGetWindowDC(IntPtr hwnd);