[英]RectangleToScreen and Windows Zoom Factor
I use this (C# .NET) call to quickly get an image of a control.我使用这个 (C# .NET) 调用来快速获取控件的图像。
Rectangle rectToCapture = myControl.RectangleToScreen(myControl.Bounds);矩形 rectToCapture = myControl.RectangleToScreen(myControl.Bounds);
However, this only works if my Windows display scaling is set to 100%.但是,这仅在我的 Windows 显示缩放设置为 100% 时才有效。 If I set the display scaling to 125% this rectangle is totally wrong.如果我将显示比例设置为 125%,这个矩形是完全错误的。 How can I capture the correct rectangle regardless of scaling?无论缩放如何,如何捕获正确的矩形?
Per @Jimi I had to make the form DPIAware.根据@Jimi,我必须制作 DPIAware 表格。
https://social.msdn.microsoft.com/Forums/windows/en-US/4d3979d4-88df-44af-8b66-16b1d4d41d57/issue-with-vs2015-windows-form-dpi-and-screen-resolution?forum=winforms https://social.msdn.microsoft.com/Forums/windows/en-US/4d3979d4-88df-44af-8b66-16b1d4d41d57/issue-with-vs2015-windows-form-dpi-and-screen-resolution?forum=表格
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.