private static Bitmap GrabScreenGDI(Rectangle rect)
{
var bmp = new Bitmap(rect.Width, rect.Height, PixelFormat.Format32bppArgb);
var graphics = Graphics.FromImage(bmp);
try
{
graphics.CopyFromScreen(rect.Left, rect.Top, 0, 0, rect.Size, CopyPixelOperation.SourceCopy);
}
catch (Exception e)
{
}
graphics.Dispose();
return bmp;
}