1

I know there are many questions like this but none of their answers are working for me or just I can't do it correctly, anyway if it's possible please give me a simple code!

I know the location of the green dot and I want to construct a rectangle based on this location.

Example:

enter image description here

And most important how to take a screenshot of this area?

I don't know how to change this code to work for my case.

private Bitmap Screenshot()
    {
        Bitmap bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);

        Graphics g = Graphics.FromImage(bmpScreenshot);

        g.CopyFromScreen(0, 0, 0, 0, Screen.PrimaryScreen.Bounds.Size);

        return bmpScreenshot;
    }
Richard
  • 29,854
  • 11
  • 77
  • 120
Nqkoi
  • 57
  • 1
  • 7
  • 2
    I don't see any real attempt to figure this out, only a single line that, that copies what displayed on the current monitor – Security Hound Nov 14 '12 at 23:09

1 Answers1

6

Merging the documentation on MSDN and your problem:

g.CopyFromScreen(center.X - 36, center.Y - 30, 0, 0, new Size(36 * 2, 30 * 2));
Austin Salonen
  • 49,173
  • 15
  • 109
  • 139