I want get location of pixel color !
But its not working whats is rong?
Attachment 99321
But its not working whats is rong?
Attachment 99321
Code:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim screensize As Size = New Size(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)
Dim screenshot As New Bitmap(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)
Dim g As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(screenshot)
g.CopyFromScreen(New Point(0, 0), New Point(0, 0), screensize)
Dim pointx As Integer = 30
Dim pointy As Integer = 30
Dim looking As Boolean = True
While looking = True
Dim atpoint As Color = screenshot.GetPixel(pointx, pointy)
Dim White As Color = Color.FromArgb(255, 252, 242)
If atpoint = White Then
Cursor.Position = New Point(pointx, pointy)
looking = False
pointx = 1
pointy = 1
MessageBox.Show("Found")
End If
pointy = pointy + 1
If pointy = My.Computer.Screen.Bounds.Height Then
pointy = 0
pointx = pointx + 1
MessageBox.Show("Not Found")
End If
End While
End Sub