开发者

How to render text in Directwrite? [duplicate]

This question already exists: Closed 11 years ago.

Possible Duplicate:

Is th开发者_如何学Goere any way to render text into DirectWrite????

Hello, all is it possible to render text in Directwrite and save it as png image using ASP.NET C# for my web application. IF YES please HELP. Thanks


I dont know if you its That what you mean but try this.

Bitmap bitmap = new Bitmap(100, 100);
Graphics g = Graphics.FromImage(bitmap);
g.DrawString("HALLO", new Font("Arial", 12), Brushes.Black, new PointF(10, 10));
bitmap.Save(<Put Filestream here>);


i don't know more about DirectWrite but if you have got the string value you need to render you can render it easy

void fun()
{
    int width = 220, height = 115;
    int xPosition=5,yPosition=5;
    Image m = new Bitmap(width,height);
    Graphics gx = Graphics.FromImage(m);
    gx.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
    gx.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
    gx.DrawString("Hello Wrold", new System.Drawing.Font("tahoma", 12.0f), Brushes.Black, xPosition, yPosition);
    m.Save(@"d:\myimage.png",ImageFormat.Png);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜