Hello, I'm trying to solve a problem with graphics and drawing. To start with, i define a picturebox region, then with fillrectangle i draw into that region.
What i would do now is creating a Bitmap from that drawn region (because then i need to use bitmap.getpixel to check colors) but I'm kinda stuck on this.
I tried to do:
Bitmap img = (Bitmap)picturebox.image
or even
Bitmap img = new Bitmap((Bitmap)picturebox.image, new size (470,340))
but when i try it or try to operate with it, i get error, saying the parameter cannot be null. It suggests image as an error, like it doesn't properly get an image while converting to bitmap. What i simply need is to convert that drawn region into a Bitmap however, in any possible way.
What i would do now is creating a Bitmap from that drawn region (because then i need to use bitmap.getpixel to check colors) but I'm kinda stuck on this.
I tried to do:
Bitmap img = (Bitmap)picturebox.image
or even
Bitmap img = new Bitmap((Bitmap)picturebox.image, new size (470,340))
but when i try it or try to operate with it, i get error, saying the parameter cannot be null. It suggests image as an error, like it doesn't properly get an image while converting to bitmap. What i simply need is to convert that drawn region into a Bitmap however, in any possible way.