new Point(134, 181) is the destination, so it is out of bounds
replace it by new Point(0, 0)
(and don't use Dispose when you use using...)
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
When I Run this code I get a black png:
class Program
{
static void Main(string[] args)
{
Console.ReadLine();
using (Bitmap screenshot = new Bitmap(53, 21))
{
System.IO.File.Delete("C:\\test.png");
using (Graphics image = Graphics.FromImage(screenshot))
{
image.CopyFromScreen(new Point(81, 160), new Point(134, 181), new Size(53, 21));
}
screenshot.Save("C:\\test.png");
screenshot.Dispose();
}
}
}
any ideas why?
new Point(134, 181) is the destination, so it is out of bounds
replace it by new Point(0, 0)
(and don't use Dispose when you use using...)