Getting Pixel Value

  • Thread starter Thread starter Raju
  • Start date Start date
R

Raju

Is there any way to get and set the pixel value in a
container control(form, picturebox...)?
 
PictureBox has an Image object that you can get/set. Until you set the
Image there are no Pixels in the PictureBox. To set the image, you must
have created an Image object from something.

Image is an abstract class, so you must have created it from a subclass
object (e.g. a BitMap) and that object would give you access to the Pixels.

Given just an object of type PictureBox, or one of type Image, I don't see
any way to get the Pixels. You need to save the object from which you
created the Image (which you put in the PictureBox) to recover the Pixels.

If you have a windows handle you can get a bitmap via FromHbitmap from the
Image in the PictureBox. But that is a static method in Image and has no
real relation to the PictureBox that contains the Image.

That's my understanding but I could be wrong.
 
Back
Top