如何衡量字符串的像素宽度drawed超过Drawing.Bitmap在.NET? [英] How to measure the pixel width of the string drawed over Drawing.Bitmap in .NET?
本文介绍了如何衡量字符串的像素宽度drawed超过Drawing.Bitmap在.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.
我如何做到这一点?
推荐答案
使用 Graphics.MeasureString()
计算宽度。
Use Graphics.MeasureString()
to compute the width.
这篇关于如何衡量字符串的像素宽度drawed超过Drawing.Bitmap在.NET?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文