How do you get the color of a pixel?
I would like some sorce code. Thanks in advance :)
------------------
Website
Printable View
How do you get the color of a pixel?
I would like some sorce code. Thanks in advance :)
------------------
Website
The easiest way is using Point which is supported by picture boxes:
-
Color=Picture1.Point (10,10)
-
But ya can also use the *much* faster API command. (You need the DC of the picture box):
-
'In module
Declare Function GetPixel Lib "gdi32" Alias "GetPixel" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
'Anywhere
Dim DC as Long
Dim Color as Long
DC = Picture1.hDC
Color = GetPixel( DC, 10, 20 )
-
i think that's enough ;)
------------------
[email protected]
...
Every program can be reduced to one instruction which doesn't work.
Thanks again. :)
Also will this work if the picture's on a form?
------------------
Website
[This message has been edited by *Super Sniper* (edited 02-17-2000).]
Yes, Forms and Pictures are nearly the same.
It doesn't work. :(
------------------
Website