我知道这个问题已经回答过了。但是,没有一个答案是正确的。如何捕获Windows窗体的图像并将其保存。我用这个:
Bitmap bmp = new Bitmap(this.Width, this.Height);
this.DrawToBitmap(bmp, new Rectangle(Point.Empty, bmp.Size));
bmp.Save(@"C://Desktop//sample.png",ImageFormat.Png);
Run Code Online (Sandbox Code Playgroud)
但得到错误:
GDI +中发生一般错误
我还阅读了有关此错误的信息,但没有任何建议对我有用!请帮忙