В GDI+ возникла ошибка общего вида или процесс занят - C#
Формулировка задачи:
Bitmap printscreen = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)
Graphics graphics = Graphics.FromImage(printscreen as Image);
graphics.CopyFromScreen(new Point(0, 0), new Point(), printscreen.Size);
printscreen.Save("printscreen.png", ImageFormat.Png);
printscreen.Dispose();var fs = new FileStream(filePath, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
_bmp = new Bitmap(fs);
fs.Dispose();Решение задачи: «В GDI+ возникла ошибка общего вида или процесс занят»
textual
Листинг программы
private void button1_Click(object sender, EventArgs e)
{
for (int i = 0; i <= 5; i++)
{
Bitmap printscreen = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
Graphics graphics = Graphics.FromImage(printscreen as Image);
graphics.CopyFromScreen(new Point(0, 0), new Point(), printscreen.Size);
printscreen.Save("printscreen" + i.ToString() + ".png", ImageFormat.Png);
printscreen.Dispose();
}
}