在Windows窗体抗锯齿文本 [英] Anti-aliasing text in Windows Forms

查看:142
本文介绍了在Windows窗体抗锯齿文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WinForms形式,并希望让这个所有文本(比如标签,按钮)的反走样。这是推动我疯了,因为我无法找到谷歌,这要么意味着它是如此明显或我的方式关闭基地东西。

I have a WinForms form, and would like to make it so that all text (e.g. labels, buttons) is anti-aliased. This is driving me crazy because I can't find anything on google, which either means it's so obvious or I'm way off-base.

我最好的想法已经重写的OnPaint在我的主要形式,但是这似乎并没有改变任何东西。

My best idea has been to override OnPaint in my main form, but this doesn't seem to change anything.

protected override void OnPaint(PaintEventArgs e) {
    e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
    base.OnPaint(e);
}

帮助!

推荐答案

这是因为你做了什么,只影响文字直接在窗体上画。我猜你将不得不重写的OnPaint在用户控件子类化标签,按钮等。

This is because what you did only affects text drawn directly on the form. I guess you would have to override OnPaint in user controls subclassing labels, buttons, etc.

这篇关于在Windows窗体抗锯齿文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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