Delphi 7 应用程序的高 DPI 解决方案,包括嵌入 Chromium (DCEF)

问题描述

Delphi7 应用程序在 4k 显示器中看起来不错。 Windows 10 可以帮助他们。他们使用“DPI 意识”和“GDI 缩放”。但是如果应用程序包含 Chromium DCEF3(或 DCEF4 无关紧要)的组件,则会发生冲突。因为为了看起来不错,“GDI 缩放”和“DPI 意识”不需要 Chromium(DCEF)。

通过清单文件切换 DPI 应用程序的简单方法。对于我的应用程序 MShop.exe,我添加了文件 MShop.exe.manifest:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
    <assemblyIdentity
        version="1.0.0.0"
        processorArchitecture="X86"
        name="Melbis Shop"
        type="win32"
    />
    <asmv3:application>
            <asmv3:windowsSettings>
                <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware> 
                <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness> 
                <gdiScaling xmlns="http://schemas.microsoft.com/SMI/2017/WindowsSettings">true</gdiScaling>
            </asmv3:windowsSettings>
        </asmv3:application>

    <description>Melbis Shop e-commerce</description>
    <dependency> 
        <dependentAssembly>
            <assemblyIdentity
                type="win32"
                name="Microsoft.Windows.Common-Controls"
                version="6.0.0.0"
                processorArchitecture="x86"
                publicKeyToken="6595b64144ccf1df"
                language="*"
            />
        </dependentAssembly>
    </dependency>
   <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
      <security>
      <requestedPrivileges>
        <requestedExecutionLevel
          level="requireAdministrator"
          uiAccess="false"/>
      </requestedPrivileges>
    </security>
   </trustInfo>
</assembly>

在这种情况下,我对应用程序(大图标和控件的文本)进行了很好的缩放,但对于 HTML 编辑器(DCEF3 组件)的缩放效果不佳(不需要):

Pic1

如果我在文件 MShop.exe.manifest 中使用另一种方式拒绝“DPI 感知”(仅更改行):

                <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware> 
                <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">system</dpiAwareness> 

在这种情况下,我对应用程序(小图标和控件的文本)没有(不良)缩放,但对 HTML 编辑器(DCEF3 组件)没有(良好)缩放:

Pic2

也许,一种可能的方法是为放置在文件 libcef.dll 中的 Chromium 组件添加第二个清单文件?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...