// Capture screenshot
static System.Drawing.Bitmap GetScreenshot(System.Drawing.Rectangle bounds = default)
{
if (bounds == default)
bounds = Screen.GetBounds(System.Drawing.Point.Empty);
System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(bounds.Width, bounds.Height);
using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmap))
{
g.CopyFromScreen(System.Drawing.Point.Empty, System.Drawing.Point.Empty, bounds.Size);
}
return bitmap;
}
// Capture screenshot
static System.Drawing.Bitmap GetScreenshot(System.Drawing.Rectangle bounds = default)
{
if (bounds == default)
bounds = Screen.GetBounds(System.Drawing.Point.Empty);
System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(bounds.Width, bounds.Height);
using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmap))
{
g.CopyFromScreen(System.Drawing.Point.Empty, System.Drawing.Point.Empty, bounds.Size);
}
return bitmap;
}