我想将“Hello dalvir”呈现为图像格式,以便hello dalvir在图像中显示为红色。我怎么能用C#来做。
答案 0 :(得分:1)
这是代码......
Font MyFont = new Font(FontFamily, Font,FontStyle.Bold, GraphicsUnit.Point);
MyGraphics = Graphics.FromImage(bmpImage);
MyGraphics.Clear(Color.FromName("Red"));
MyGraphics.TextRenderingHint = TextRenderingHint.AntiAlias;
MyGraphics.DrawString("Hello dalvir", MyFont,
new SolidBrush(Color.FromName("Red")), 0, 0);
MyGraphics.Flush();