Start with the following method: Dim r As RichTextBox = RichTextBox1 Dim lines, iFirst, iLast As Int32 iFirst = r.GetLineFromCharIndex (r.GetCharIndexFromPosition (New Point (0, 0))) iLast = r.GetLineFromCharIndex (r.GetCharIndexFromPosition (New Point (0, R.HEIGHT)) LINES = Ilast - IFirst MessageBox.Show (Lines) But found not very accurate, if the scroll bar is the correct number of rows when the scroll bar is in the middle, if there is no character in RichTextBox, or characters There are many, it is not right when there is no scroll bar.
The following method can:
Dimg as graphics g = richtextbox1.creategraphics () lines = richtextbox1.height / g.MeasureString ("test", richtextbox1.font) .height () MessageBox.show (Lines)