You can handle VScoll
event to detect vertical scrolling and use function
private static double GetRichTextBoxScrolPos(RichTextBox textBox)
{
if(textBox1.TextLength == 0) return 0;
var p1 = textBox.GetPositionFromCharIndex(0);
var p2 = textBox.GetPositionFromCharIndex(textBox.TextLength - 1);
int scrollPos = -p1.Y;
int maxScrolPos = p2.Y - p1.Y - textBox.ClientSize.Height;
if(maxScrolPos <= 0) return 0;
double d = 100.0 * (double)scrollPos / (double)maxScrolPos;
if(d < 0) d = 0;
else if(d > 100) d = 100;
return d;
}
to determine scroll position. Result is in % (100% = fully scrolled to bottom).
Important note: This function is not absolutely accurate, but you may find result accurate enougth. It can be further improved by measuring bottom line height (using Graphics
object for example). 100% reliable way is to aquire VScrollBar
handle and query its position using WinAPI, but that will requre much more work.