Aero:如何在玻璃上绘制ClearType文本? [英] Aero: How to draw ClearType text on glass?

查看:146
本文介绍了Aero:如何在玻璃上绘制ClearType文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用GDI +在玻璃上绘制文本:

Using GDI+ to draw text on glass:

graphics.DrawString(s, Length(s), font, MakePointF(x, y), brush);

您会注意到启用了ClearType的文本在玻璃上的绘制效果非常

You'll notice that the ClearType enabled text draws very poorly on glass:

但是,如果用玻璃杯禁用文字, ,请罚款:

But with glass disabled the text, of course, draw fine:

通过比较的方法是抗锯齿字体平滑

这是没有字体平滑

注意:没有字体平滑效果比实际效果好,因为StackOverflow会调整显示器上图像的大小。

Note: No font smoothing looks better than it really does because StackOverflow resizes the images on your monitor.

如何绘制ClearType文本

How do i draw ClearType text on glass?


  • Win32本机

  • 不是.NET(本机为 ie

  • 不是Winforms(本机为 ie

  • GDI +(本地的 ie

  • Win32 native
  • not .NET (i.e. native)
  • not Winforms (i.e. native)
  • GDI+ (i.e. native)

什么马克暗示您无法兑现用户的文本呈现偏好设置(即 SystemDefault 。 ClearType在玻璃上不起作用,因此无法使用。

What Mark is suggesting is that you cannot honor the user's preferences for text rendering (i.e. "SystemDefault". ClearType does not function on glass, and you cannot use it.

换句话说,如果要在玻璃上渲染,则必须使用以下命令覆盖文本渲染:

In other words, if you're rendering on glass you must override the text rendering with:

graphics.SetTextRenderingHint(TextRenderingHintAntiAliasGridFit);

否则,应将 TextRenderingHint 保留在默认 TextRenderingHintSystemDefault

Otherwise you should leave the TextRenderingHint at it's default TextRenderingHintSystemDefault.

  • Aero: How to draw solid colors on glass?
  • Windows Aero: What color to paint to make "glass" appear?
  • WPF: Extending glass into client area disables ClearType entirely

推荐答案

问题是绘图方式所固有的。您所有的文字都在黑色背景上绘制,然后合成到玻璃背景上;半透明的字体平滑与黑色结合使用,使颜色接近黑色。

The problem is inherent to the way drawing is performed. All of your text is being drawn on a black background, then composited onto a glass background; the semi-transparent font smoothing is being combined with black to make near-black.

这篇关于Aero:如何在玻璃上绘制ClearType文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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