getting pixels
-
-
Hi Anyone out there know how to do a 'GetPixel' (i.e. find what colour is at a Point) with c#? There's a method GetPixel for a BitMap, but not for an arbitrary point on the screen (or a graphics object). MFC had what I needed, but it's gone from .NET!
chris fearnley wrote: (or a graphics object). You can assign a Bitmap to graphic object with
Graphics.FromImage()
,then if you do change in graphic object it is reflected in bitmap. SoGetPixel()
works there too. I can't undestand how it doesn't solve it. Mazy "A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope -
chris fearnley wrote: (or a graphics object). You can assign a Bitmap to graphic object with
Graphics.FromImage()
,then if you do change in graphic object it is reflected in bitmap. SoGetPixel()
works there too. I can't undestand how it doesn't solve it. Mazy "A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope -
I don't have an image to use
Graphics.FromImage()
, I just have some lines that have been mathematically drawn. Can I convert the whole area into a Bitmap,then useGetPixel()
?Search this site to find lots of example. You can first create a
Bitmap
object and assign it toGraphics
object, then draw whatever you want to it. This will works I think. Mazy "A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope