i am working on a project in vb.net 2003 and i want to get the color of a pixel when i click on the image loaded in the picturebox. i ve tried anything but nothing seems to work.... help please
:'(

This is for VB.NET 2005 and I hope it works in 2003 too

Private Sub PictureBox1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseClick
  '
  Dim TempBitmap As New Bitmap(PictureBox1.Image)
  Dim MyColor As Color

  MyColor = TempBitmap.GetPixel(e.X, e.Y)
  MessageBox.Show("Pixel x=" & e.X & ", y=" & e.Y & ", color=" & MyColor.ToString, "Color", MessageBoxButtons.OK, MessageBoxIcon.Information)

End Sub

Make sure that an image is loaded to picturebox before mouse click.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.