Size sif;
private void MeasureText(PaintEventArgs e)
{
string str;
str = "大";
Font f = this.textBox1.Font;
sif = TextRenderer.MeasureText(e.Graphics, str, f, new Size(0, 0), TextFormatFlags.NoPadding);
// MessageBox.Show((sif.Width ).ToString());
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
MeasureText(e);
}
获取字符串长度
最新推荐文章于 2024-03-06 00:35:39 发布