vb.net屏幕抓图 vbs截图代码( 三 )


Private Const SRCCOPY = HCC0020
Private WithEvents Picture As PictureBox
Private WithEvents Button As CommandButton
Private Sub Form_Initialize()
Set Picture = Controls.Add("VB.PictureBox", "Picture", Me)
Picture.Move 0, 0, Screen.Width, Screen.Height
Picture.BorderStyle = 0
Picture.Appearance = 0
Set Button = Controls.Add("VB.CommandButton", "Button", Me)
Button.Width = 80 * 15
Button.Height = 25 * 15
Button.Caption = "全屏截图"
Button.Visible = True
Call Button.Move((Me.ScaleWidth - Button.Width) / 2, (Me.ScaleHeight - Button.Height) / 2, Button.Width, Button.Height)
End Sub
Private Sub Button_Click()
Dim lngDesktopDC As Long
Picture.AutoRedraw = True
lngDesktopDC = GetDC(GetDesktopWindow())
Call BitBlt(Picture.hdc, 0, 0, Screen.Width, Screen.Height, lngDesktopDC, 0, 0, SRCCOPY)
Picture.Picture = Picture.Image
Call ReleaseDC(GetDesktopWindow(), lngDesktopDC)
Call SavePicture(Picture.Image, App.Path"\"Format(Now, "YYYYMMDDHHMMSS")".bmp")
End Sub
vb.net屏幕抓图的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于vbs截图代码、vb.net屏幕抓图的信息别忘了在本站进行查找喔 。

推荐阅读