只是保存Form上所有的内容最简单方法就是调用DrawToBitmap方法 然后把这个图片保存到硬盘上 代码如下 private void button1_Click(object sender, EventArgs e)
{
Bitmap bit1 = new Bitmap(this.Width, this.Height);
this.DrawToBitmap(bit1, new Rectangle(0, 0, this.Width, this.Height));
int border = (this.Width - this.ClientSize.Width) / 2;//边框宽度
int caption = (this.Height - this.ClientSize.Height) - border;//标题栏高度
Bitmap bit2 = bit1.Clone(new Rectangle(border, caption, this.ClientSize.Width, this.ClientSize.Height), System.Drawing.Imaging.PixelFormat.Format24bppRgb);
bit1.Save("D:\\AAA.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);//包括标题栏和边框
bit2.Save("D:\\BBB.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);//不包括标题栏和边框
bit1.Dispose();
bit2.Dispose();
}
如果是Form上的图像,当然简单 就是Bitmap类Bitmap.Save("C:\1.jpg") 搞定 如果是把Form窗口截图保存,这个就用几个api也可以搞定了GetWindowRectGetDCReleaseDCBitBlt 再结合Graphics类就可以了
推荐个论坛:江南网盟,免费注册,希望采纳~