Bitmap btm = new Bitmap(100, 100);
Graphics g = Graphics.FromImage(btm);
Font f = new Font("C:\\WINDOWS\\FONTS\\msyh.ttf", 10F, System.Drawing.FontStyle.Regular);//字体
//单位为mm
g.PageUnit = GraphicsUnit.Millimeter;
SizeF sim = g.MeasureString(item, f);//item需要查询的字符串的长度
Graphics g = Graphics.FromImage(btm);
Font f = new Font("C:\\WINDOWS\\FONTS\\msyh.ttf", 10F, System.Drawing.FontStyle.Regular);//字体
//单位为mm
g.PageUnit = GraphicsUnit.Millimeter;
SizeF sim = g.MeasureString(item, f);//item需要查询的字符串的长度