Copy Screen Object to Bitmap File
This is not a big deal, but it is worth to share for everyone. 1 private void copyScreen( string filename) 2 { 3 Bitmap bmp = new Bitmap( this .Width, this .Height); 4 Graphics gBmp = Graphics.FromImage(bmp); 5 IntPtr gBmpHdc = gBmp.GetHdc(); 6 IntPtr srcHdc = Win32Api.GetWindowDC( this .Handle); 7 Win32Api.BitBlt(gBmpHdc, 0 , 0 , this .Width, this .Height, 8 srcHdc, 0 , 0 , 9 Win32Api.SRCCOPY); 10 Win32Api.ReleaseDC( this .Handle, srcHdc); 11 12 bmp.Save(filename, System.Drawing.Imaging.ImageFormat.Bmp); 13 14 gBmp.ReleaseHdc(gBmpHdc); 15 16 gBmp.Dispose(); 17 18 bmp.Dispose(); 19 20 } 21 I