目前,我有以下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