getpixelr=color mod 256
g=color \ 256 mod 256
b=color \ 65536 mod 256
g=color \ 256 mod 256
b=color \ 65536 mod 256
解决方案 »
- 还是求助 如何将一个 text 中的序列 单个取出
- 给execl 加边框
- 在VB中用webbrowser加载word文档后,怎么另存不了?
- vb6中怎么很快回到之前的源程序bookmark?
- c++ 转 vb 150分求助
- 请教高手:关于98下临时改变系统环境变量的方法
- 如何调用存储过程的返回参数值
- office 真的是拿vb写的吗 ???
- 谁有提供winsock2.0的资料吗?
- 怎样用api函数playsound()构建一个函数,可以实现播放声音,循环播放声音停止播放声音
- 如何调用1个API函数,及使用过程?
- 请csdn得管理员注意一下,我在vb得数据库分论坛发了帖子,我点“将帖子提前”,我的帖子并没有提前!怎么回事?
'- two picture boxes
'- a button
Private Type POINTAPI
X As Long
Y As Long
End TypePrivate Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function SetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long) As Long
Private Declare Function PaintDesktop Lib "user32" (ByVal hdc As Long) As Long
Private Declare Function StretchBlt Lib "gdi32" (ByVal hdc 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 nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
Private Declare Function GetBkColor Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function MoveToEx Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, lpPoint As POINTAPI) As Long
Private Declare Function LineTo Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long) As LongConst ScrCopy = &HCC0020
Const Yellow = &HFFFF&
Private Sub Form_Load()
'KPD-Team 1998
'URL: http://www.allapi.net/
'E-Mail: [email protected]
Dim Cnt1 As Byte, Cnt2 As Byte, Point As POINTAPI
'Set the graphic mode to persistent
Me.AutoRedraw = True
'API uses pixels
Me.ScaleMode = vbPixels
Picture1.ScaleMode = vbPixels
Picture2.ScaleMode = vbPixels
'No borders
Picture1.BorderStyle = 0: Picture2.BorderStyle = 0
'Set the button's caption
Command1.Caption = "Paint && Stretch"
'Set the graphic mode to 'non persistent'
Picture1.AutoRedraw = False: Picture2.AutoRedraw = False
For Cnt1 = 0 To 100 Step 3
For Cnt2 = 0 To 100 Step 3
next cnt2
next cnt1
end sub
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private Const WM_GETTEXTLENGTH = &HE
Private Const WM_GETTEXT = &HD
Private Const WM_SETTEXT = &HC
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As LongPrivate Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End TypeConst cX As Long = 41
Const cY As Long = 69
Const cStep As Long = 36
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Dim gHdc As Long
Dim lColor As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Dim R As RECT
Dim Lshu As Long
Dim WZ As POINTAPI
Dim Hw As Long
Dim k As Long
Dim wHwnd As Long
Dim wHDC As Long
Dim gX As Long
Dim gY As Long
Dim cColor As LongPrivate Sub Timer2_Timer()k = GetCursorPos(WZ)
Hw = WindowFromPoint(WZ.x, WZ.y)
wHDC = GetDC(wHwnd)
cColor = GetPixel(wHDC, WZ.x, WZ.y)
Me.Caption = Hex(cColor)End Sub