Public Class Form1
Dim col As Integer = 45
Dim row As Integer = 39
Private Sub Form1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
Select Case e.KeyCode
Case Keys.Right
If CType(PictureBox1.Image, System.Drawing.Bitmap).GetPixel(PictureBox2.Right + 1, PictureBox2.Top).ToArgb() = Color.Black.ToArgb() Then
Label1.Text = "Black"
Else
Label1.Text = "White"
End If
col = col + 1
PictureBox2.Location = New Point(col, row)
e.Handled = True
Case Keys.Left
If CType(PictureBox1.Image, System.Drawing.Bitmap).GetPixel(PictureBox2.Left - 1, PictureBox2.Top).ToArgb() = Color.Black.ToArgb() Then
Label1.Text = "Black"
Else
Label1.Text = "White"
End If
col = col - 1
PictureBox2.Location = New Point(col, row)
e.Handled = True
Case Keys.Up
If CType(PictureBox1.Image, System.Drawing.Bitmap).GetPixel(PictureBox2.Top - 1, PictureBox2.Top).ToArgb() = Color.Black.ToArgb() Then
Label1.Text = "Black"
Else
Label1.Text = "White"
End If
row = row - 1
PictureBox2.Location = New Point(col, row)
e.Handled = True
Case Keys.Down
If CType(PictureBox1.Image, System.Drawing.Bitmap).GetPixel(PictureBox2.Bottom + 1, PictureBox2.Top).ToArgb() = Color.Black.ToArgb() Then
Label1.Text = "Black"
Else
Label1.Text = "White"
End If
row = row + 1
PictureBox2.Location = New Point(col, row)
e.Handled = True
End Select
End Sub
End Class