Maintain TextBox scroll position while adding line
Auto-scrolling text box uses more memory than expected
The code in the question implements exactly what you are looking for. Text is added, but scrolling only occurs if the scroll bar is at the very bottom.