读出“外观和个性化”的“显示”

时间:2012-05-14 11:43:34

标签: c# windows-7 controlpanel

我想宣读"显示" - 设置"外观和个性化"的价值。在带有C#-App的Windows7的控制面板中,因为之前的启动应用程序必须检查该值是否设置为100%并且如果不是这样则通知用户。

这是我的意思是控制面板: http://maketecheasier.com/change-icon-size-and-display-settings-in-windows-7/2010/01/12

提前谢谢!

我试过了:

1 个答案:

答案 0 :(得分:0)

您正在使用Windows中的两个“dpi”设置,一个在水平方向,一个在垂直方向。 dpiXdpiY相同是很常见的:

float dpiX, dpiY;
Graphics graphics = this.CreateGraphics();
dpiX = graphics.DpiX;
dpiY = graphics.DpiY;

注意:大多数程序写得不好,do not handle high-dpi display setting正常。因此,从Windows Vista开始,Microsoft可以使用 声明它正确支持高dpi显示的任何应用程序。应用程序被告知显示仍然设置为(传统默认值)96dpi。 Windows然后使用视频卡调整应用程序的大小以使其更大:

enter image description here

您可以通过向应用manifest添加条目来选择退出高dpi缩放

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 
    <assemblyIdentity 
            version="1.0.0.0"
            processorArchitecture="X86"
            name="client"
            type="win32"
    /> 

    <description>My Super Cool Application</description> 

    <!-- We are high-dpi aware on Windows Vista -->
    <asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
        <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
            <dpiAware>true</dpiAware>
        </asmv3:windowsSettings>
    </asmv3:application>

    <!-- We were designed and tested on Windows 7 -->
    <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
        <application>
            <!--The ID below indicates application support for Windows Vista -->
            <!--supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/ -->
            <!--The ID below indicates application support for Windows 7 -->
            <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
        </application>
    </compatibility>

    <!-- Disable file and registry virtualization -->
    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
        <security>
            <requestedPrivileges>
                <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
            </requestedPrivileges>
        </security>
    </trustInfo>

</assembly>