如何在Windows窗体应用程序中修复高DPI上的模糊字体? [英] How to fix blurry fonts on high DPI in windows form application?
问题描述
大家好,
我在Visual Studio 2010(.Net framework 3.5)中创建了一个桌面应用程序。当我在分辨率为1920 * 1080的机器上运行此应用程序时,它运行正常。
现在,当我在另一台分辨率为3200 * 1800的机器上运行此应用程序时,字体变得模糊。
基于文章这里,我使我的应用程序DPI意识到。
另外,我对主窗体进行了以下更改:
Hi All,
I've created a desktop application in Visual Studio 2010 (.Net framework 3.5). When I run this application on my machine having resolution 1920 * 1080, it runs fine.
Now when I run this application on another machine having resolution 3200 * 1800, the fonts get blurred.
Based on the article here, I made my application "DPI aware".
Also, I’ve made the below changes for the main form:
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
我尝试了什么:
进行这些更改后,它在我的机器上运行正常,分辨率为1920 * 1080。在高分辨率机器上,字体看起来不错,但此表单上所有控件的大小都已更改。
有人可以帮忙吗?
提前致谢!
What I have tried:
After making these changes, it runs fine on my machine having resolution 1920 * 1080. On the high resolution machine, the fonts look good but the size of all the controls on this form changed.
Can someone please help?
Thanks in advance!
推荐答案
尝试
try
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
高分辨率& Windows窗体不是最好的组合。 Conscider将您的应用程序移动到WPF。
High resolutions & windows forms are not the best combo. Conscider moving your application to WPF.
这篇关于如何在Windows窗体应用程序中修复高DPI上的模糊字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!