您好,我收到“ GDI +中发生一般错误”。用这种方法
public async void Disconnect()
{
using (Bitmap bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height))
{
Graphics graphics = Graphics.FromImage(bitmap as Image);
graphics.CopyFromScreen(0, 0, 0, 0, bitmap.Size);
bitmap.Save(dcSS);
}
using (Stream stream = System.IO.File.OpenRead(dcSS))
{
await Bot.SendPhotoAsync(teleChatId, stream, "Timer Ended " + DateTime.Now);
}
Ipconfig("/release");
Thread.Sleep(5000);
Ipconfig("/renew");
timer.Reset();
}
在“ bitmap.Save(“ test.gif”);”行中,我不知道我还能尝试处理什么,在保存之前删除该图像。但是我一直在获取它,奇怪的是,那是该代码将运行一次,如果我关闭并重新打开程序,它将只能运行1次,第一次后我会收到此错误
编辑:更新的代码仍然无法正常工作