开发者

How to measure the pixel width of the string drawed over Drawing.Bitmap in .NET?

I am generating a .png image that contains a text dynamically written.

I need to create the bitmap with the minimum width for file size reasons.

How do I do t开发者_开发百科his?


Use Graphics.MeasureString() to compute the width.


You can also use TextRenderer for slightly more accuracy. See this article for differences between this and Graphics.MeasureString :

http://msdn.microsoft.com/en-us/magazine/cc751527.aspx

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜