Function MakeScreenShot() As Drawing.Bitmap
Dim out As Drawing.Bitmap
Dim bounds As Rectangle = Screen.GetBounds(Point.Empty)
out = New Drawing.Bitmap(bounds.Width, bounds.Height)
Using gr As Drawing.Graphics = Graphics.FromImage(out)
gr.CopyFromScreen(Point.Empty, Point.Empty, bounds.Size)
End Using
Return out
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim BM As Drawing.Bitmap = MakeScreenShot()
Dim mouseloc As Point = Cursor.Position
Dim c As Color = BM.GetPixel(mouseloc.X, mouseloc.Y)
MessageBox.Show(c.R & "," & c.G & "," & c.B)
End Sub