How to get displayed text from RichTextBox?
You want to use RichTextBox.GetCharIndexFromPosition(). To get the index of the first visible character, pass new Point(0, 0), the upper left corner of the RTB client area. To get the index of the last visible character, pass new Point(rtb.ClientSize.Width, rtb.ClientSize.Height). RichTextBox.Text.Substring() then gets you all visible text.
If necessary, you can use RichTextBox.GetLineFromCharIndex() to translate the character indexes to line numbers.