我制作了这个 VB.NET 代码来拍摄整个屏幕的照片,但它只拍摄了焦点区域的照片。为什么是这样?
Public Function SaveScreen(ByVal theFile As String) As Boolean
Try
SendKeys.Send("{PRTSC}")
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