vb点虐 抓图控件 vba抓取网页数据

VB截取屏幕

[DllImport("user32.dll", EntryPoint = "GetDC")]

创新新互联,凭借十余年的网站设计制作、网站设计经验,本着真心·诚心服务的企业理念服务于成都中小企业设计网站有1000+案例。做网站建设,选创新互联。

public static extern IntPtr GetDC(IntPtr hWnd);

[DllImport("user32.dll", EntryPoint = "ReleaseDC")]

public static extern IntPtr ReleaseDC(IntPtr hWnd, IntPtr hDC);

[DllImport("user32.dll", SetLastError = true)]

static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);

[DllImport("user32.dll", SetLastError = true)]

static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

先找到你要截图的那个窗体的 句柄 然后根据这个句柄得到改窗体的DC 创建一个bitmap 然后填充 得到的bitmap后 显示到picturebox里面

vb点虐 如何动态添加picturebox 控件数组(在不知道图片大小的情况下)

Dim PictureBox11(1) as PictureBox ‘放在最前面

Dim i as integer

Form_load 设i=0

动态添加:

if ipicturebox11.ubound then load(picturebox11(i))

picturebox11(i).loadpicture("图片地址")

Picture11(i).PaintPicture Picture11(i).Picture, 0, 0, Picture11(i).Width, Picture11(i).Height

picturebox11(i).visible=true

i=i+1

动态删除

i=i-1

unload picturebox11(i)

vb点虐 图片按钮如何实现?用什么控件?

用Button控件就可以了 修改BackgroundImage 属性 类似这样

Button1.BackgroundImage = Image.FromFile("C:\Users\hp\Desktop\EMOTICONS\EMOTICON SMILE.png")

如果要实现动态效果的话需要2个图片当Button1_MouseHover事件时也就是鼠标停留在button上的时候显示一个图片,当Button1_MouseLeave事件时,也就是鼠标离开button时显示原来的图片,这样就是动态的了.

VB.NET当鼠标停在屏幕任意地方,得到该点的颜色

我有个笨办法,先用API抓图到内存里,然后再在根据你点鼠标的屏幕工作区坐标,去那图里取色。

-----------------------

'抓图所需的API

Private Declare Function CreateCompatibleDC Lib "GDI32" (ByVal hDC As Integer) As Integer

Private Declare Function CreateCompatibleBitmap Lib "GDI32" (ByVal hDC As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer) As Integer

Private Declare Function SelectObject Lib "GDI32" (ByVal hDC As Integer, ByVal hObject As Integer) As Integer

Private Declare Function BitBlt Lib "GDI32" (ByVal srchDC As Integer, ByVal srcX As Integer, ByVal srcY As Integer, ByVal srcW As Integer, ByVal srcH As Integer, ByVal desthDC As Integer, ByVal destX As Integer, ByVal destY As Integer, ByVal op As Integer) As Integer

Private Declare Function DeleteDC Lib "GDI32" (ByVal hDC As Integer) As Integer

Private Declare Function DeleteObject Lib "GDI32" (ByVal hObj As Integer) As Integer

Declare Function GetDC Lib "user32" Alias "GetDC" (ByVal hwnd As Integer) As Integer

Const SRCCOPY As Integer = HCC0020

'抓图的部分

Dim hDC, hMDC As Integer

Dim hBMP, hBMPOld As Integer

Dim sw, sh As Integer

hDC = GetDC(0)

hMDC = CreateCompatibleDC(hDC)

sw = Screen.PrimaryScreen.Bounds.Width

sh = Screen.PrimaryScreen.Bounds.Height

hBMP = CreateCompatibleBitmap(hDC, sw, sh)

hBMPOld = SelectObject(hMDC, hBMP)

BitBlt(hMDC, 0, 0, sw, sh, hDC, 0, 0, SRCCOPY)

hBMP = SelectObject(hMDC, hBMPOld)

Dim bmp As Bitmap = Image.FromHbitmap(New IntPtr(hBMP))

DeleteDC(hDC)

DeleteDC(hMDC)

DeleteObject(hBMP)

......

'取点的颜色

bmp.GetPixel(e.X, e.Y)

----------------------------

关键就是这些你自己组合吧,你分给的太少了,很麻烦,恕我不帮你改全了。如果要仔细帮你改,请另开高分贴,不要用新马甲来


标题名称:vb点虐 抓图控件 vba抓取网页数据
转载来源:http://bzwzjz.com/article/ddgephi.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 成都营销网站建设 成都网站建设 网站制作 重庆企业网站建设 公司网站建设 成都网站建设 定制网站设计 成都网站建设 营销网站建设 成都网站建设公司 成都企业网站设计 做网站设计 成都网站建设 手机网站制作 高端网站设计推广 手机网站设计 成都网站建设公司 营销型网站建设 成都营销网站制作 企业网站建设 成都网站设计公司 成都网站制作