我正在使用此代码使用我的VB应用程序截取屏幕截图:
Dim bounds As Rectangle
Dim screenshot As System.Drawing.Bitmap
Dim graph As Graphics
bounds = Screen.PrimaryScreen.Bounds
screenshot = New System.Drawing.Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppRgb)
graph = Graphics.FromImage(screenshot)
graph.CopyFromScreen(0, 0, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
screenshot.Save("c:\Screenshot.png", Imaging.ImageFormat.Png)
End Sub
如何在同一张地图中保存多个屏幕截图? (例如,screenshot1.png,screenshot2.png,....)
再次感谢。
PS:如果有2台显示器,有没有办法拍摄'全屏'截图?
答案 0 :(得分:1)
发布答案因周转时间
即使您发布的原始代码不会在我的系统上编译,但是我的评论以及Pro Grammers评论,这应该可以解决问题。
Dim bounds As Rectangle
Dim screenshot As System.Drawing.Bitmap
Dim graph As Graphics
Dim TimeStamp = DateTime.Now.ToLongTimeString & "_" & DateTime.Now.ToShortDateString()
Label1.Text = TimeStamp
bounds = Screen.PrimaryScreen.Bounds
screenshot = New System.Drawing.Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppRgb)
graph = Graphics.FromImage(screenshot)
graph.CopyFromScreen(0, 0, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
screenshot.Save("c:\Screenshot_" & TimeStamp & ".png", Imaging.ImageFormat.Png)
玩弄时间戳,看看哪些适合你。