如何使Winform不受Windows DPI设置更改的影响? [英] How do I keep my Winform unaffected from Windows DPI setting changes ?

查看:799
本文介绍了如何使Winform不受Windows DPI设置更改的影响?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个放置图像的Winform。设计在Win 7上,DPI为100%。



当将DPI更改为125%或更高后显示相同的Winform时,我发现图像已移位Winform。



Winform可能因DPI更改而自动缩放,但Image(嵌入在Resx文件中)不会缩放。



目前,winform的AutoScaleMode设置为Font,AutoSizeMode设置为GrowOnly。我尝试在没有水果的情况下切换这些设置。



因此,如何在更高DPI设置的Winform上正确获取图像?或者如何让这个Winform不受DPI变化的影响?



请指教。



非常感谢任何帮助。

Hi,

I have a Winform on which a image is placed. Designed on Win 7 with DPI at 100%.

When the same Winform is displayed after changing the DPI to 125% or higher, I observe that the Image is displaced on the Winform.

The Winform was possibly Auto scaled due to DPI changes but the Image (which is embedded in the Resx file) wont get scaled.

Currently, The winform's AutoScaleMode is set to "Font" and the "AutoSizeMode" is set to "GrowOnly". I tried toggling these setting with no fruits.

Thus, How would I get the Image properly on my Winform in Higher DPI settings? OR How can I make this Winform remain unaffected from DPI changes ?

Please advise.

Any help is greatly appreciated.

推荐答案

更改表单的 AutoScaleMode Dpi



/ ravi
Change your Form's AutoScaleMode to Dpi.

/ravi


这篇关于如何使Winform不受Windows DPI设置更改的影响?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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