Pixel Color

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to know if there is a way to click on an image and be able to
get the color of the pixel that the stylus is touching? (ie. if the stylus is
touching red then I would like to be able to return that it is touching red)


nb
 
bmp.GetPixel()

where bmp is the bitmap assigned a picture box for example.
 
You can do it for anywhere on the screen with a bit of P/Invoke. Use GetDC
passing in IntPtr.Zero for the context for the entire screen. Then use
GetPixel to retrieve the rgb value of any pixel. Remember also to ReleaseDC
when you've finished.

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top