I have a WinForms application where one of the controls is set to a specific size. 800x600. There is a function to screenshot the control that relies on the on screen size being the same as what is returned in code.
On one of my test machines, it renders fine. The correct size, everything works. On another machine, it renders at 1.25 times the size. In code if I use Control.ClientSize I get 800x600, whereas using an external tool (ShareX, which shows window sizes) it reads as 1000x750. This is reflected in the screenshots, where a large portion of the image is cut off. I know this is down to the DPI scaling, since both machines are outputting 1920x1080 resolution, but the secondary machine has a scaling of 125% vs the primary which is at 100%. As well, if I adjust the scaling down to 100%, the code runs as expected.
My question is then, is there a way to either force the form to render at the desired size (with the control at 800x600, and yes I have tried AutoScaleMode = AutoScaleMode.Dpi), or have a method that will return the actual true size of the control when scaling is accounted for?