关于dpi awareness 的清单文件设置

要设置dpi 意识,一般是使用SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE)来设置

 

具体可参考:Setting the default DPI awareness for a process

 

不过官方更建议使用清单文件来设置dpi意识,我介绍一下方法:

新建一个后缀为.manifest的文件,然后在其中添加如下代码

<?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"></requestedExecutionLevel>
      </requestedPrivileges>
    </security>
  </trustInfo>
  <application>
    <windowsSettings>
      <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
      <!-- legacy -->
      <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">permonitorv2,permonitor</dpiAwareness>
      <!-- falls back to pm if pmv2 is not available -->
    </windowsSettings>
  </application>
</assembly>

保存后,在项目中添加这个文件,最后debug就可以了

请注意:也有其他方法可以设置dpi意识,看下图

关于dpi awareness 的清单文件设置

直接改选项就可以了

原文链接: https://www.cnblogs.com/strive-sun/p/12206640.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍;

也有高质量的技术群,里面有嵌入式、搜广推等BAT大佬

    关于dpi awareness 的清单文件设置

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/405001

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年4月25日 下午4:50
下一篇 2023年4月25日 下午4:50

相关推荐