计算字符串的宽度

  Graphics graphics = CreateGraphics();
  SizeF sizeF = graphics.MeasureString(lblAccount.Text, new Font(this.Font.Name,this.fontSize, FontStyle.Regular));
  graphics.Dispose();
  int xWidth = Convert.ToInt32(sizeF.Width);

          

posted @ 2011-09-20 11:04  rui90102  阅读(290)  评论(0编辑  收藏  举报