Capture Panel Image in C# on different screens

19 Views Asked by At

I have created a form that someone can sign their signature, and this will be saved as a bitmap to be printed onto a sheet. The issue I have is that when I capture the panel on screen with scaling that is not a 100% (is either 125% or 150%), it grabs a different part of the screen.

I have tried setting the form autoscale to DPI and other settings but nothing seem to work. Here is the code I have been using.


                Point location = PointToScreen(panel1.Location);
               
                int width = panel1.Width;
                int height = panel1.Height;

                Bitmap bitMap = new Bitmap(width, height);
                Graphics graphics = Graphics.FromImage(bitMap as Image);

                graphics.CopyFromScreen(location.X, location.Y, 0, 0, bitMap.Size);
              
                bitMap.Save(@"C:\Multicam Machines\Data Files\Tech Signature.bmp");
0

There are 0 best solutions below