我有这段代码;使用DrawString绘制无边框文字
public static Image AddText(this Image image, ImageText text)
{
Graphics surface = Graphics.FromImage(image);
Font font = new Font("Tahoma", 10);
System.Drawing.SolidBrush brush = new SolidBrush(Color.Red);
surface.DrawString(text.Text, font, brush, new PointF { X = 30, Y = 10 });
surface.Dispose();
return image;
}
然而,当文本被绘制到我的形象,它是红色与黑色的边框或阴影。
如何在没有任何边框或阴影的情况下将文字写入图像?
EDIT
我通过添加解决了这个;
surface.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
如果有人能解释为什么我需要这样做会很好。
如何将您的编辑移动到答案并选择最佳答案?这对我来说很有用。 – 2012-11-21 09:07:41