Private Sub Command1_Click()
Dim X1&, Y1&
For X1 = 0 To Picture1.Width
For Y1 = 0 To Picture1.Height
If GetPixel(Picture1.hDC, X1, Y1) = SchColor Then MsgBox CStr(X1) & "," & CStr(Y1): Exit Sub
Next Y1
Next X1
End Sub
Private Declare Function GetPixel Lib "gdi32" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long) As Long
Dim SchColor&
Private Sub Form_Load()
Picture1.ScaleMode = 3
SchColor = 0 '找黑色
End Sub
Private Sub picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.Caption = GetPixel(Picture1.hDC, X, Y) & IIf(GetPixel(Picture1.hDC, X, Y) = SchColor, " 找到啦", "")
End Sub
Private Declare Function GetPixel Lib "gdi32" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long) As Long
Dim SchColor&
Private Sub Form_Load()
Picture1.ScaleMode = 3
SchColor = 0 '找黑色
End Sub
Private Sub picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.Caption = GetPixel(Picture1.hDC, X, Y) & IIf(GetPixel(hDCp, X, Y) = SchColor, " 找到啦", "")
End Sub