Reputation: 33
I want to take a 512x280 pixel screenshot of a certain section of the screen in C# then store the RGB information in an array. If I wanted the origin (top left) of the screenshot to begin at the pixels (200,200), how would I go about doing this?
I asked this earlier and was given the following code:
However, this seems to still create the bitmap starting at the 0,0 coordinates but will just leave that area empty until it reaches the size. It creates something like this:
Where the image is pushed down and to the right however many pixels are specified in xOrigin and yOrigin.
Upvotes: 3
Views: 3239
Reputation: 239824
Look at the documentation for Graphics.CopyFromScreen. You pass it 2 sets of X/Y coordinates - the coordinates on the screen and the coordinates within your bitmap. BY the sound of things, your telling it to copy from the (0,0) screen position, to the (200,200) position in your bitmap. This is probably the wrong way around.
Upvotes: 4