Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if text exceeds the size of textbox

I have a windows multiline TextBox and is readonly. Can I check if the text within it has reached the the end? My purpose is to enable scroll if text is greater than the TextBox capacity.

like image 642
Nitish Avatar asked Feb 13 '23 22:02

Nitish


1 Answers

Try this to check if string width is less than the textbox width:

if(TextRenderer.MeasureText(txtBox.Text, txtBoxFont).Width < txtBox.Width)
like image 58
mrida Avatar answered Feb 22 '23 21:02

mrida