吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 6377|回复: 16
收起左侧

[原创工具] [福利] 源 颜色检测工具 - 供特殊需求者

  [复制链接]
370886941 发表于 2013-10-14 05:45
 准确的颜色检测工具,供给特殊需求者,有些朋友会需要准确无差的抓色,抓颜色代码比较准。

 无需求的阿大请勿喷,仅仅提供给: 你懂的 , 朋友做参考实例。  并不是什么很牛趴的工具。

[Visual Basic] 纯文本查看 复制代码
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function getpixel Lib "gdi32" Alias "GetPixel" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Dim p As POINTAPI

Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Private Const WS_EX_LAYERED = &H80000
Private Const GWL_EXSTYLE = (-20)
Private Const LWA_ALPHA = &H2
Private Const LWA_COLORKEY = &H1
Private Const HWND_TOP = 0
Private Const HWND_TOPMOST = -1
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1

Dim rtn As Long


Private Sub Form_Load()
Timer1.Enabled = True
Me.AutoRedraw = True
Me.BackColor = vbBlack
Me.ForeColor = vbRed
rtn = GetWindowLong(Me.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED
SetWindowLong Me.hwnd, GWL_EXSTYLE, rtn
SetLayeredWindowAttributes Me.hwnd, vbBlack, 180, LWA_COLORKEY Or LWA_ALPHA
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
End Sub

Private Sub Timer1_Timer()
GetCursorPos p
hd = GetDC(0)
r = getpixel(hd, p.X, p.Y)
Label4.Caption = r
csr = CStr(Hex(r))
t = Len(csr)
Select Case t
Case 1
sr = "00000" & csr
Case 2
sr = "0000" & csr
Case 3
sr = "000" & csr
Case 4
sr = "00" & csr
Case 5
sr = "0" & csr
Case 6
sr = csr
End Select
Label1.Caption = " &&H" & sr
Picture1.BackColor = r
End Sub


颜色检测工具.zip (4.03 KB, 下载次数: 41)

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

网才刘印 发表于 2013-10-15 16:57
沙发,感谢楼主的分享。
ayweihang 发表于 2013-10-15 17:07
liuphillpotts 发表于 2013-10-15 18:24
andysec 发表于 2013-10-15 18:30
好东西啊!刚好对颜色敏感度不强!感谢楼主!
1e3e 发表于 2013-10-16 08:40
好东东,谢谢分享哟
678 发表于 2013-10-16 09:05
我每次都是截图到ps取色。。。
449219454 发表于 2013-10-16 09:07
不管东西咋样 还是先谢谢了不管东西咋样 还是先谢谢了
vboy 发表于 2013-10-16 12:46
好东西  谢谢分享了哦
zhang5306 发表于 2013-10-17 07:45
谢谢大大发作品
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-24 08:52

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表