>You could get the color with "GetPixel"... then use the following >function to convert the color to GrayScale: > >Public Function GrayScale(ByVal lColor As Long) As Long > GrayScale = ((77& * (lColor And &HFF&) + _ > 150& * (lColor And &HFF00&) \ &H100& + _ > 28& * ((lColor And &HFF0000) \ &H10000)) \ 256&) * &H10101 >End Function > >Then, once the color is grayscale, convert the color to >RGB values like so: > >Public Sub SplitRGB(ByVal lColor As Long, _ > ByRef lRed As Long, _ > ByRef lGreen As Long, _ > ByRef lBlue As Long) > lRed = lColor And &HFF > lGreen = (lColor And &HFF00&) \ &H100& > lBlue = (lColor And &HFF0000) \ &H10000 >End Sub > >Then test each value of Red, Gree, Blue to see if >it is above the threshhold you mentioned (0 - 255). > >Kevin
Hi, I couldn't get the splitRGB function to work, compile error argument not optional option explicit Dim Col As Long, rBlue As Long, rRed As Long, rGreen As Long
Private Sub Picture2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = vbLeftButton Then
Picture1.BackColor = Picture2.Point(X, Y) Col = Picture1.Point(5, 5) GrayScale Col SplitRGB GrayScale, rRed, rGreen, rBlue' 'Greyscale is highlighted in this Else End If End Sub