VB.NET屏幕指定区域截图代码,保存到Image中

前端之家收集整理的这篇文章主要介绍了VB.NET屏幕指定区域截图代码,保存到Image中前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

VB.NET屏幕指定区域截图代码,保存到Image中

使用VB.NET实现屏幕上指定位置的图像进行截图功能,保存到Image中


Dim texthwnd As IntPtr
texthwnd = FindWindowEx(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,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)
原文链接:https://www.f2er.com/vb/257672.html

猜你在找的VB相关文章