Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27184

VS 2012 Get color location pixel

$
0
0
I want get location of pixel color !
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

Attached Images
 

Viewing all articles
Browse latest Browse all 27184

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>