[求助]自动检测相应坐标(X、Y表示)所对应的RGB值
如何能在form1_load中写入代码,让程序一运行就自动检测相应坐标(X、Y表示)所对应的RGB值。
用POINT取得颜色值COLOR
RED=COLOR MOD &H100
GREEN=(COLOR\&H100)MOD &H100
BLUE=(COLOR\&H10000)mod &h100
如果没记错的话,应该可以.
试一试这个:
R = Color And &HFF
G = (Color And &HFF00&) \ &H100
B = (Color And &HFF0000) \ &H10000
[此贴子已经被作者于2007-9-1 21:20:03编辑过]
Dim rgb As Long
Dim r As String, g As String, b As String
rgb = Picture1.Point(8070, 6555)
r = rgb \ &HFF
g = (rgb \ &HFF00) \ &H100
b = (rgb \ &HFF0000) \ &H10000
Text1.Text = "R:" & r & ", G:" & g & ", B:" & b
为什么这段代码返回的RGB为0,0,0?(实际RGB为238,2.32)
问题出在哪,请帮忙看看!
Dim color As Long
Dim r As String, g As String, b As String
color = Picture1.Point(8070, 6555)
r = color Mod &H100
g = (color \ &H100) Mod &H100
b = (color \ &H10000) Mod &H100
Text1.Text = "R:" & r & ", G:" & g & ", B:" & b
这样RGB=-1,0,0,为什么?
5楼说得很清楚了。