我想截取的控件名字叫做chartControl,传进来的字符串参数是你想保存的文件的路径,最后保存为名为temp的jpg格式文件:
代码如下
public void Screenshots(string filepath
)
{
Bitmap bmp
= new Bitmap(chartControl
.Width
, chartControl
.Height
);
chartControl
.DrawToBitmap(bmp
, chartControl
.ClientRectangle
);
bmp
.Save(filepath
+ "temp.jpg");
}
转载请注明原文地址: https://mac.8miu.com/read-510826.html