如果文本框输入内容超过十个字符,就取前十个字符加...
private void textBox1_TextChanged(object sender, EventArgs e)
{
if (textBox1.Text.Length > 10)
textBox1.Text = textBox1.Text.Substring(0, 10) + "...";
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
if (textBox1.Text.Length > 10)
textBox1.Text = textBox1.Text.Substring(0, 10) + "...";
}
请问有什么库函数可以计算字符串的Width(既整个字符串所占的空间长度),不是字符串的Length.