Private Declare Function GetPixel Lib "gdi32" Alias "GetPixel" (ByVal hdc As IntPtr, ByVal x As Integer, ByVal y As Integer) As Integer
Private Declare Function GetDC Lib "user32" Alias "GetDC" (ByVal hwnd As IntPtr) As IntPtr
Private Declare Function ReleaseDC Lib "user32" Alias "ReleaseDC" (ByVal hwnd As IntPtr, ByVal hdc As IntPtr) As Integer
Private Sub Panel1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseMove
Dim hdc As IntPtr = GetDC(IntPtr.Zero)
Dim p As Point = Panel1.PointToScreen(New Point(e.X, e.Y))
Dim c As Integer = GetPixel(hdc, p.X, p.Y)
Dim color As Color = ColorTranslator.FromOle(c)
ReleaseDC(IntPtr.Zero, hdc)
Panel1.BackColor = color
End Sub
That'll do it. Click on the panel and you can drag over the whole screen, the panel's background colour will change as you move over different coloured pixels.