简体   繁体   English

子进程外dpi缩放问题

[英]Child out of process window dpi scaling issue

We have an application (WPF) that hosts an out of process application (MFC) as a child window in an hwndhost. 我们有一个应用程序(WPF),它在hwndhost中将进程外应用程序(MFC)托管为子窗口。 When setting a custom DPI setting (ie 125% in Display property of Windows), the child window does not scale appropriately to the change in DPI. 设置自定义DPI设置(即Windows的Display属性中的125%)时,子窗口无法适当缩放以适应DPI的更改。 This is a legacy application that is not DPI Aware. 这是不支持DPI的旧版应用程序。 When launching the out of process application stand alone, it scales as desired (using auto display scaling from Windows). 当单独启动进程外应用程序时,它会根据需要进行缩放(使用Windows的自动显示缩放)。 Is it possible that because we are making this out of process application a child of our WPF window, it is inheriting the DPI Awareness from its parent? 是否有可能因为我们将这个进程外应用程序作为WPF窗口的子级而从其父级继承了DPI意识? Any way to fix this? 有任何解决这个问题的方法吗?

I found a similar issue here: Win32 app not affected by dpi setting when hosted by WPF app but no answer was proposed. 我在这里发现了类似的问题: 由WPF应用托管时,Win32应用不受dpi设置的影响,但未提出答案。 I would comment on the original question to see if it was figured out but I do not have enough rep and want to re-open the question to see if there is a solution. 我将对原始问题发表评论,以查看是否已解决,但我没有足够的代表,并想重新打开问题以查看是否有解决方案。

The DPI awareness of a top-level window is determined by the process that owns that top level window. 顶层窗口的DPI意识由拥有该顶层窗口的过程确定。 In your case that's the WPF window. 您的情况就是WPF窗口。 The system uses the same DPI virtualization for all children of a top level window. 系统对顶层窗口的所有子级使用相同的DPI虚拟化。

If you want your hosted child window to be virtualized then you would need the top-level window also to be virtualized. 如果要对托管子窗口进行虚拟化,则还需要对顶层窗口进行虚拟化。 Which I expect you do not want to happen. 我希望你不想发生。

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

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