目前,我有以下VB.NET代码,使我的桌面的截图,但是只需要激活屏幕的画面:拍摄画面的照片与VB.NET
Public Function SaveScreen(ByVal theFile As String) As Boolean
Try
SendKeys.Send("%{PRTSC}") '<alt + printscreen>
Application.DoEvents()
Dim data As IDataObject = Clipboard.GetDataObject()
If data.GetDataPresent(GetType(System.Drawing.Bitmap)) Then
Dim bmp As Bitmap = CType(data.GetData(GetType(System.Drawing.Bitmap)), Bitmap)
bmp.Save(theFile, Imaging.ImageFormat.Png)
End If
Clipboard.SetDataObject(0) 'save memory by removing the image from the clipboard
Return True
Catch ex As Exception
Return False
End Try
End Function
下面的代码是我如何执行上述功能,如果这有什么差别,我不认为它的作用:
SaveScreen("C:\Lexer_trace\screen.png")
现在,我需要能够把整个屏幕的图片,而不仅仅是聚焦窗口。我将如何做到这一点?
由于提前,
洛根
[此链接](http://vbtab.blogspot.com/2013/11/how-to-take-a-screenshot-print-screen-using-vb- net.html)可能会解释得很好.. – Jasir