[DllImport("gdi32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]
public static extern int BitBlt(HandleRef hDesDC, int x, int y, int w, int h,
HandleRef hSrcDC, int xSrc, int ySrc, int dwRop);
public static Bitmap FromGraphics(Graphics g, int w, int h)
{
const int SRCCOPY = 0xcc0020;
Bitmap b = new Bitmap(w, h);
Graphics gd = Graphics.FromImage(b);