1.根据文字换行
this.TextBox1.Multiline=true;
2.控件自适应高度
在这里插入代 private void TextBox1_TextChanged(object sender, EventArgs e)
{
int h = TextBox1.Height;
for (int i = 0; i < TextBox1.Lines.Length ; i++)
{
TextBox1.Height += h;
}
}码片
本文介绍了如何在C#中使用TextBox控件实现根据文字内容自动换行以及调整控件高度以适应显示全部内容的需求,分为文字换行和控件高度自适应两个部分进行详细讲解。
1475

被折叠的 条评论
为什么被折叠?



