C#中,窗口快照生成图片保存在本地是如何实现的?跪求例子。。。
展开全部
Bitmap image = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
Graphics imgGraphics = Graphics.FromImage(image);
imgGraphics.CopyFromScreen(0, 0, 0, 0, new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height));//从屏幕截取图像,范围可自己调整
SaveFileDialog op = new SaveFileDialog();
虚灶 春誉蠢 op.Filter = "图片文件|*.bmp;*,jpg;*.png";
if (op.ShowDialog() == DialogResult.OK)//显示保存文件对话框
{
扒陪 image.Save(op.FileName);//保存图片
MessageBox.Show("图片保存成功!");
}
imgGraphics.Dispose();
image.Dispose();
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询