To je to, hvala
Evo klase
Code:
public static class MyBitmap
{
[DllImport("gdi32.dll")]
private static extern bool BitBlt(
IntPtr hdcDest, // handle to destination DC
int nXDest, // x-coord of destination upper-left corner
int nYDest, // y-coord of destination upper-left corner
int nWidth, // width of destination rectangle
int nHeight, // height of destination rectangle
IntPtr hdcSrc, // handle to source DC
int nXSrc, // x-coordinate of source upper-left corner
int nYSrc, // y-coordinate of source upper-left corner
uint dwRop // raster operation code
);
public static Bitmap FromGraphics(Graphics g)
{
int w = (int) g.VisibleClipBounds.Width;
int h = (int) g.VisibleClipBounds.Height;
Bitmap b = new Bitmap(w, h, g);
Graphics bg = Graphics.FromImage(b);
IntPtr gdc = g.GetHdc();
IntPtr bgdc = bg.GetHdc();
BitBlt(bgdc, 0, 0, w, h, gdc, 0, 0, 0x00CC0020);
g.ReleaseHdc(gdc);
bg.ReleaseHdc(bgdc);
bg.Dispose();
return b;
}
}