C#截图自动保存图片到指定位置的问题
try
{
Screen scr = Screen.PrimaryScreen;
Rectangle rc = scr.Bounds;
int iWidth = rc.Width;
int iHeight = rc.Height;
Bitmap myImage = new Bitmap(iWidth, iHeight);
Graphics gl = Graphics.FromImage(myImage);
gl.CopyFromScreen(new Point(0, 0), new Point(0, 0), new Size(iWidth, iHeight));
_img = myImage;
pictureBox1.Image = _img;
// IntPtr dc1 = gl.GetHdc();
//gl.ReleaseHdc(dc1);
_img.Save(@"C:\\1.jpeg");
//_img.Save("c:\\1.jpeg");
//SendFile("c:\\1.jpeg");
}
catch (Exception ex)
{
MessageBox.Show("截屏失败!\n" + ex.Message.ToString() + "\n" + ex.StackTrace.ToString());
}
怎么把我截的图保存到指定的路径下面呢??在网上找过说是用 _img.Save(@"C:\\1.jpeg");这句可以完成,但是老是提示GDI+一般性错误。求大侠指教
------解决方案--------------------无C盘读写权限,改到D盘 _img.Save(@"d:\\1.jpeg");