VB.NET屏幕指定区域截图代码,保存到Image中
使用VB.NET实现屏幕上指定位置的图像进行截图功能,保存到Image中
Dim texthwnd As IntPtr texthwnd = FindWindowEx(0, 0, vbNullString, "等待输入验证码") Dim pl As SwtPj.WINDOWPLACEMENT GetWindowPlacement(texthwnd, pl) Dim image As Bitmap = New Bitmap(119, 34) Dim g As Graphics = Graphics.FromImage(image) ShowWindow(texthwnd, SHOW_WINDOW.SW_SHOWNORMAL) My.Application.DoEvents() SetWindowPos(texthwnd, -1, 0, 0, 0, 0, 3) My.Application.DoEvents() System.Threading.Thread.Sleep(200) g.CopyFromScreen(New Point(pl.rcNormalPosition.Left + 58, pl.rcNormalPosition.Top + 94), New Point(0, 0), New Size(119, 34)) me.PictureBox1.Image = CType(image, Image)
时间: 2024-10-12 17:46:49