我已经创建了绘图程序。它使用 System.graphics 在 panel1 上以表格形式绘制矩形等。 图形 鼠标绘制事件: 绘制 我想从 panel1 获取艺术作为位图,尝试了以下代码:
using (var bmp = new Bitmap(panel1.Width, panel1.Height))
{
panel1.DrawToBitmap(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height));
bmp.Save("output.png", System.Drawing.Imaging.ImageFormat.Jpeg);
}
但它会在图像中生成 panel1 的背景颜色