110,534
社区成员
发帖
与我相关
我的任务
分享
StringFormat stringFormat = new StringFormat(StringFormat.GenericTypographic);
stringFormat.FormatFlags |= StringFormatFlags.MeasureTrailingSpaces;
SizeF sizeF = g.MeasureString(str, font, maxwidth, stringFormat);
RectangleF rectF = new RectangleF(x, y, sizeF.Width, height);
e.Graphics.DrawString(str, font, brush, rectF, stringFormat);