保存多个屏幕截图
本文关键字:屏幕截图 保存 | 更新日期: 2023-09-27 18:23:54
我的目标是捕捉整个桌面的屏幕截图。
我将计时器设置为5秒间隔,只是为了进行测试。
我正在使用此代码进行屏幕截图:
int screenLeft = SystemInformation.VirtualScreen.Left;
int screenTop = SystemInformation.VirtualScreen.Top;
int screenWidth = SystemInformation.VirtualScreen.Width;
int screenHeight = SystemInformation.VirtualScreen.Height;
using (Bitmap bmp = new Bitmap(screenWidth, screenHeight))
{
using (Graphics g = Graphics.FromImage(bmp))
{
g.CopyFromScreen(screenLeft, screenTop, 0, 0, bmp.Size);
}
bmp.Save(screenPath);
}
至于屏幕路径
string screenPath = @"c://EventScout/Screen " + DateTime.Now.ToString("yyyyMMddHHmmss") + ".png";
除了我最后只看到一张截图之外,一切都很好。
我做错了什么?有什么想法或线索吗?
您需要在每次迭代中更改要保存的文件名。