如何禁用Elementhost(Winform控件)DPI感知? [英] How to disable Elementhost(Winform control) DPI awareness?

查看:369
本文介绍了如何禁用Elementhost(Winform控件)DPI感知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景

我们有一个由C ++实现的应用程序。某些MFC对话框包含winform activeX控件。在winform activeX控件中,有一个包含WPF内容的elementhost控件。

We have an application implemented by C++. Some of the MFC dialogs hold a winform activeX control. Inside the winform activeX control, there is an elementhost control which contains the WPF content.

问题

一切顺利直到应用程序在高DPI(150%)上运行。当DPI很高时,似乎Elementhost(或WPF)控件将执行自动缩放。虽然自动缩放会影响整个应用程序的行为。 

Everything goes well until the application is running on high DPI (150%). When DPI is high, it seems that Elementhost (or WPF) controls will do auto scaling. While the auto scaling will impact the behavior of the whole application. 

问题

我可以禁用自动元素主机控件或WPF控件的缩放?

Can I disable the auto scaling for elementhost control or WPF control?

我知道有一种方法可以禁用WPF应用程序的DPI感知,但我想要的是禁用用户控制DPI感知。我不想更改c ++应用程序设置。

I know there is a way to disable DPI awareness for WPF application, but what I want is to disable user control DPI awareness. I don't want to change the c++ application setting.

推荐答案





嗨  ; Tiny Stone,



>>我知道有办法禁用DPI对WPF应用程序的认识,但我想要的是禁用用户控制DPI感知。我不想更改c ++应用程序设置。



不幸的是,没有内置属性为WPF元素设置。我没有找到一种禁用用户控制DPI感知的特殊方法。



您可以尝试其他方式。 



例如: 



使用视图框缩放所有内容(根据屏幕DPI计算视图框大小)。 



此外,以下建议供您参考。 />


禁用单个元素的DPI感知



$

最好的问候,



Yong Lu


Hi  Tiny Stone,

>>I know there is a way to disable DPI awareness for WPF application, but what I want is to disable user control DPI awareness. I don't want to change the c++ application setting.

Unfortunately, there isn't build in property to set that for WPF element. I did not find a special way to disable user control DPI awareness.

You can try other ways. 

For example: 

Use view box to scale all content(calculate view box size basing on screen DPI). 

Also, the following suggestion for your reference.

Disable DPI awareness for a single element



Best Regards,

Yong Lu


这篇关于如何禁用Elementhost(Winform控件)DPI感知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆