【发布时间】:2010-05-20 05:44:18
【问题描述】:
我有这个代码;
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;
}
但是,当文本被绘制到我的图像上时,它是带有黑色边框或阴影的红色。
如何在没有任何边框或阴影的图像中写入文本?
编辑
我通过添加解决了这个问题;
surface.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
如果有人能解释我为什么需要这个,那就太好了。
【问题讨论】:
-
如何将您的编辑移至答案并将其选为最佳答案?这对我有用。
标签: c# system.drawing