Graphics.DrawString VS TextRenderer.DrawText?哪位能提供更好的质量 [英] Graphics.DrawString vs TextRenderer.DrawText?Which can Deliver Better Quality

查看:941
本文介绍了Graphics.DrawString VS TextRenderer.DrawText?哪位能提供更好的质量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

TextRenderer是基于GDI和Graphics.DrawString是基于GDI这些功能+。其中可以在图像上绘制文本提供质量更好的文本。

TextRenderer is based on GDI and Graphics.DrawString is based on GDI+.Which of these functions can deliver better quality text while drawing text on an image.

推荐答案

只是我的2分钱:我总是用Graphics.DrawString,除了的时候我需要做定制的绘画对我(Windows窗体)控制。例如,在一个列表框,有的OwnerDraw集,如果我附上DRAWITEM事件处理程序,充分描绘项目,包括项目文本。或自定义控制我一定要画自己。

Just my 2 cents: I always use Graphics.DrawString, except when I need to do custom painting for my (Windows Forms) controls. For example in a listbox that has OwnerDraw set, if I attach a DrawItem event handler that fully paints items, including item text. Or in a custom control I have to paint myself.

在使用视觉样式,支持它,有它启用了,文字绘制相比其他绘制控件常规文本Graphics.DrawString看起来关闭OS上的应用程序。这似乎是,主要是因为在路上ClearType的差异(或没有)来处理,虽然我不知道,我没有文档来支持这种说法了。 (有点它看起来像文本的方式做了净1.x或切换的FlatStyle时,从标准到系统和VV)

In an application that uses Visual Styles on an OS that supports it and has it enabled, text drawn with Graphics.DrawString looks "off" when compared to regular text drawn by other controls. This appears to be mainly because of differences in the way "ClearType" is (or is not) handled, although I am not sure and I do not have docs to back that statement up. (It sort of looks like the way text did on .Net 1.x or when switching FlatStyle from Standard to System and v.v.)

在这种情况下,只有(在WinForms控件文字画)我用TextRenderer.DrawText使文本更好地融合在一起,其他控件。

In such cases only (text painting on Winforms controls) I use TextRenderer.DrawText to make the text better blend in with the other controls.

如果与当地人融合的是不是你关心的问题之一(它的样子,因为你要画的图像上)我会去Graphics.DrawString。另外,如果你想要打印,你一定要,因为TextRenderer只能在屏幕上(不是打印机画布)。

If "blending in with the natives" is not one of your concerns (which it looks like, since you want to draw on an image) I'd go for Graphics.DrawString. Also, if you'd want printing, you must, since TextRenderer only works on screen (not the printer canvas).

这篇关于Graphics.DrawString VS TextRenderer.DrawText?哪位能提供更好的质量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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