VB屏幕截图,保存到位图文件
成都创新互联专注于海原网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供海原营销型网站建设,海原网站制作、海原网页设计、海原网站官网定制、重庆小程序开发服务,打造海原网络公司原创品牌,更为您提供海原网站排名全网营销落地服务。
'声明部分
Option Explicit
Private Const SRCCOPY = HCC0020
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
'窗体代码部分
Private Sub Form_Load()
Me.AutoRedraw = True
End Sub
Private Sub Command1_Click()
CopyScreen "d:\1.bmp"
End Sub
Sub CopyScreen(FileName As String)
Dim w As Long, h As Long
Dim hwndSrc As Long
Dim hSrcDC As Long
hwndSrc = GetDesktopWindow()
hSrcDC = GetWindowDC(hwndSrc)
w = Screen.Width \ Screen.TwipsPerPixelX
h = Screen.Height \ Screen.TwipsPerPixelY
Call BitBlt(hdc, 0, 0, w, h, hSrcDC, 0, 0, SRCCOPY)
Call ReleaseDC(hwndSrc, hSrcDC)
SavePicture Me.Image, FileName
End Sub
将整个屏幕截图保存到指定文件名的位图文件
CopyScreen(FileName As String)
参数 FileName 为完整路径文件名即可
INTOUCH自带的就有,打印屏幕的命令
自己写个时间条件运行那命令就可以了
PRINTSCREEN这个命令 具体怎么用 看下帮助
希望我的回答对你有所帮助
如有其他问题,可以继续追问,您的采纳是我前进的动力!
'没办法,需的把窗口隐藏一下,还的隐藏后延迟一下再截图。
Dim WithEvents Timer1 As New Timer With {.Interval = 30, .Enabled = False}
Dim Imgrect As Rectangle
Dim img As Bitmap
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Imgrect = Me.RectangleToScreen(Me.ClientRectangle)
img = New Bitmap(Imgrect.Width, Imgrect.Height)
Me.Hide()
Timer1.Start()
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Timer1.Stop()
Graphics.FromImage(img).CopyFromScreen(Imgrect.X, Imgrect.Y, 0, 0, Imgrect.Size)
Me.BackgroundImage = img
Me.Show()
End Sub
按 Alt+Print Print键在del的上面 再上面就是 答案补充 之后到word里 ctrl+V粘贴就可以了