在Windows窗体抗锯齿文本窗体、文本、抗锯齿、Windows

2023-09-03 04:22:07 作者:我墨迹你莫急^

我有一个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.