I am having trouble saving a bitmap to my hardrive, this is the code im using:
{
class Program
{
static void Main(string[] args)
{
using (Bitmap screenshot = new Bitmap(53, 21))
{
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");
}
}
}
}
when I run it i get an error on the screenshot.save line it puts a break there and says System.Runtime.InteropServices.ExternalException: 'A generic error occurred in GDI+.'
Any ideas why?