简体   繁体   English

启用 DPI 感知设置无效 (VisualStudio 2017)

[英]Enable DPI Awareness setting has no effect (VisualStudio 2017)

I want my program to be DPI aware but I don'T want to set the default awareness programmatically because this is not recommended according to the microsoft docs( https://docs.microsoft.com/en-us/windows/win32/hidpi/setting-the-default-dpi-awareness-for-a-process ).我希望我的程序能够感知 DPI,但我不想以编程方式设置默认感知,因为根据 microsoft docs( https://docs.microsoft.com/en-us/windows/win32/hidpi )不推荐这样做/setting-the-default-dpi-awareness-for-a-process )。 The Enable DPI Awareness in the project configuration has no effect on the manifest or the programm itself.项目配置中的 Enable DPI Awareness 对清单或程序本身没有影响。

What I did: I added a manifest File我做了什么:我添加了一个清单文件添加了清单文件 I also enabled the DPI Awareness我还启用了 DPI Awareness 将启用 DPI 感知设置为是 After clear+rebuild it creates a manifest but but all I get is this manifest file without any dpi aware tags.清除+重建后,它会创建一个清单,但我得到的只是这个清单文件,没有任何 dpi 感知标签。

   <?xml version='1.0' encoding='UTF-8' standalone='yes'?>
    <assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
     <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
      <security>
       <requestedPrivileges>
        <requestedExecutionLevel level='asInvoker' uiAccess='false' />
       </requestedPrivileges>
      </security>
     </trustInfo>
    </assembly>

I read the docs but I am not able to make it work.我阅读了文档,但无法使其正常工作。 A manual edit won't help because the manifest is generated on build: https://docs.microsoft.com/en-us/cpp/build/understanding-manifest-generation-for-c-cpp-programs?view=vs-2019手动编辑无济于事,因为清单是在构建时生成的: https : //docs.microsoft.com/en-us/cpp/build/understanding-manifest-generation-for-c-cpp-programs?view=vs -2019

Hope you can help.希望你能帮忙。 I try to answer as fast as possible.我尽量尽快回答。 If you need more information please let me know如果您需要更多信息,请告诉我

  • This appears to be a bug in VS2017.这似乎是 VS2017 中的一个错误。 If you can upgrade to VS2019 you should upgrade.如果可以升级到 VS2019,则应该升级。 This solved the problem for me.这为我解决了这个问题。

  • If you can't upgrade you can right click on the .exe and enable the如果您无法升级,您可以右键单击 .exe 并启用
    dpi aware flag in the accessibility settings.辅助功能设置中的 dpi 感知标志。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM