在VB.NET中获取完整的屏幕截图(Visual Studio 2017)

时间:2019-06-13 04:13:33

标签: vb.net

我有一个程序会自动获取屏幕截图并将其保存到文件中(理想情况下,不要太大)。

主要问题是,我在互联网上(以下)找到的代码没有完整的屏幕截图。我正在寻找全屏截图。有关如何修改代码的任何建议?

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.Format32bppArgb)
graph = Graphics.FromImage(screenshot)
graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
PictureBox1.Image = screenshot

0 个答案:

没有答案