在 WinForms 文本呈现上禁用抗锯齿 [英] Disable Anti-aliasing on WinForms text rendering
问题描述
我正在用 WinForms C# 开发应用程序,设计者强迫我使用抗锯齿文本.尽管没有明显的方法来设置文本渲染模式,但在应用程序中需要使用别名文本.
I'm developing an application in WinForms C#, and the designer is forcing me to use Anti-Aliased text. Aliased text is a requirement in the application, although there is no obvious way to set the text rendering mode.
如果您好奇,该应用程序是一个小型模拟应用程序,其外观和感觉就像您在使用 Windows 95.
If you're curious, the application is a small simulation app designed to look and feel as if you were using Windows 95.
如何禁用文本抗锯齿?
推荐答案
在 program.cs 中,有一个标志 Application.SetCompatibleTextRenderingDefault(false);
.当此值设置为 true 时,它似乎禁用了抗锯齿并提供了我需要的结果.
In program.cs, there is a flag Application.SetCompatibleTextRenderingDefault(false);
. When this value is set to true, it seems to disable anti-aliasing and gives me the result I need.
这篇关于在 WinForms 文本呈现上禁用抗锯齿的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!