当前位置:网站首页>Getting the return value of DPI function is always 96 | getting the return value of DPI function is incorrect | why the return value of getdpiformonitor/getdevicecaps is incorrect

Getting the return value of DPI function is always 96 | getting the return value of DPI function is incorrect | why the return value of getdpiformonitor/getdevicecaps is incorrect

2022-06-22 04:47:00 kim-2006

tired , Take a look at my sister and relax !

Text

No matter how you adjust the system zoom , Use GetDpiForMonitor/GetDeviceCaps obtain DPI The return value of is always 96!

After searching the Internet, there is no correct solution , It took nearly an hour to figure out the reason !

It is hereby posted for future generations !

The reason is simple , In the previous test, you set high in the properties of the program DPI Set in the “ Program DPI” As a result of , high DPI Scaling overrides can also have an effect , See the figure for details !

The solution goes without saying !

GetScaleFactorForMonitor This function is not affected by the above settings , But this function only supports WIN10/WIN11 Such as system .

原网站

版权声明
本文为[kim-2006]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206220442532896.html