/// <summary>
/// 计算文本的宽度
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static int GetStringLength(string str, int AddLength = )
{
Font f = new Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, GraphicsUnit.Pixel);
Size sif = TextRenderer.MeasureText(str, f, new Size(, ), TextFormatFlags.NoPadding);
return sif.Width + AddLength;
//MessageBox.Show((sif.Width / pdi).ToString());
}
05-11 12:56