0

I'm making a universal application for myself (mainly to learn and challenge myself), I want to capture the top left of my second monitor (2nd is on the left side), but I only know how to capture on my main monitor

            Rectangle rect = new Rectangle(0, 0, 100, 100);
            Bitmap bm = new Bitmap(rect.Width, rect.Height, PixelFormat.Format32bppArgb);
            Graphics g = Graphics.FromImage(bm);
            g.CopyFromScreen(0, 0, 0, 0, bm.Size);
            pictureBox1.Image = bm;
JLW1808
  • 106
  • 9
  • 2
    Change the coordinates for `g.CopyFromScreen()` to the area you want to capture. If your primary monitor is the one on the right, and the upper-left corner of that monitor are at 0, 0, then your left (secondary) monitor's coordinates are going to be negative. Capture an area at -500, 0 and see what you get in your PictureBox. – Ken White Jul 24 '19 at 01:51
  • Read the notes here: [Using SetWindowPos with multiple monitors](https://stackoverflow.com/a/53026765/7444103). Don't rush over the DPI Awareness part. – Jimi Jul 24 '19 at 06:41

1 Answers1

1

"Change the coordinates for g.CopyFromScreen() to the area you want to capture. If your primary monitor is the one on the right, and the upper-left corner of that monitor are at 0, 0, then your left (secondary) monitor's coordinates are going to be negative. Capture an area at -500, 0 and see what you get in your PictureBox."

JLW1808
  • 106
  • 9