老师,有以下截图代码,第一次截图成功后,第二次截图时选择区域后点击“×”还是能够保存,好像是ClipBoard.GetImage(粘贴板)上内容不为空造成的,麻烦帮忙解决一下,谢谢!
Dim proc As New Process
proc.File = ApplicationPath & "capture.exe"
proc.WaitForClose = True
proc.Start
Dim fl2 As String = ProjectPath & "Reports\" & Format(Date.Now , "yyyyMMddHHmmss") & CStr (Rand.Next(10000, 99999)) & ".png"
If ClipBoard.GetImage IsNot Nothing Then
ClipBoard.GetImage.save(fl2)
Else
MessageBox.Show("截图失败,请重新截图!", "提示")
Return
End If
解决代码:
ClipBoard.Clear '清除粘贴板
[此贴子已经被作者于2022/11/14 16:21:06编辑过]