如何获得Windows显示设置? [英] How to get Windows Display settings?
问题描述
有被设置在Windows 7显示器(控制面板 - >显示)。它允许更改文本,并在屏幕上的其他项目的大小。
我需要得到此设置能够根据设定值来开启/关闭某些功能在我的C#应用程序。
这可能吗?
There is setting for Display in Windows 7 (Control Panel -> Display). It allows to change the size of the text and other items on the screen. I need to get this setting to be able to switch on/switch off some functionality in my C# application based on the setting value. Is that possible?
推荐答案
这是设置在屏幕DPI,或每英寸点数。
This setting is the screen DPI, or dots per inch.
阅读它像这样:
float dpiX, dpiY;
Graphics graphics = this.CreateGraphics();
dpiX = graphics.DpiX;
dpiY = graphics.DpiY;
我不认为这是可能的,此刻的X和Y值是不同的。 96的值对应于100%的字体定标(小),120对应于125%缩放(培养基)和144对应于150%的缩放(放大)。然而,用户可以设置其他值比这些标准的。
I don't think it's possible at the moment for the X and Y values to be different. A value of 96 corresponds to 100% font scaling (smaller), 120 corresponds to 125% scaling (medium) and 144 corresponds to 150% scaling (larger). However, users are able to set values other than these standard ones.
这篇关于如何获得Windows显示设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!