vb 如何把窗口内容保存为图片
1个回答
展开全部
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Const theForm = 1
Const theScreen = 0
Private Sub Command1_Click()
Picture1.Visible = False
Picture1.Move 0, 0, Me.Width, Me.Height
Call keybd_event(vbKeySnapshot, theForm, 0, 0) '截取活动的本窗体,若theForm改成theScreen则Copy整个Screen
DoEvents
Picture1.Picture = Clipboard.GetData(vbCFBitmap) 'Picture1.Picture得到剪切板的内容(截取的本窗体)
Clipboard.Clear
PhotoName = "\VB截图.Bmp"
PhotoName1 = App.Path & PhotoName
SavePicture Picture1.Image, PhotoName1
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询