//
当前窗口宽度
int iWidth = this .Width;
// 当前窗口高度
int iHeight = this .Height;
// 截取主屏幕
Screen scrPrimary = Screen.PrimaryScreen;
// 创建一个和屏幕一样大的Bitmap
Image myImage = new Bitmap(iWidth, iHeight);
// 从一个继承自Image类的对象中创建Graphics对象
Graphics graphi = Graphics.FromImage(myImage);
// 抓屏并拷贝到myimage里
graphi.CopyFromScreen( new Point( this .Location.X, this .Location.Y), new Point( 0 , 0 ), new Size(iWidth, iHeight));
// 保存并存储文件
myImage.Save( @" c:/1.jpeg " );
int iWidth = this .Width;
// 当前窗口高度
int iHeight = this .Height;
// 截取主屏幕
Screen scrPrimary = Screen.PrimaryScreen;
// 创建一个和屏幕一样大的Bitmap
Image myImage = new Bitmap(iWidth, iHeight);
// 从一个继承自Image类的对象中创建Graphics对象
Graphics graphi = Graphics.FromImage(myImage);
// 抓屏并拷贝到myimage里
graphi.CopyFromScreen( new Point( this .Location.X, this .Location.Y), new Point( 0 , 0 ), new Size(iWidth, iHeight));
// 保存并存储文件
myImage.Save( @" c:/1.jpeg " );