Ekranımıza bir adet textBox nesnesi koyalım. MultiLine özelliğini true yapalım. Daha sonra textChanged eventina aşağıdaki kodumuzu yazalım.
int satirsayisi = this.textBox1.GetLineFromCharIndex(this.textBox1.TextLength) + 1;
int border = this.textBox1.Height - this.textBox1.ClientSize.Height;
this.textBox1.Height = this.textBox1.Font.Height * satirsayisi + 3 + border;
programı çalıştırdığımız zaman textBox1 kutusuna veri girilip satır doldukça yeni bir satır kadar textBox1 in yüksekliği artacaktır.
Hiç yorum yok:
Yorum Gönder