How to get the selected line in a Text Box?
I figured this out myself:
Rect rec = textbox.GetRectFromCharacterIndex(textbox.SelectionStart);
double rectop = rec.Top;
double lineheight = text.LineHeight;
int result = (int)(rectop / lineheight + 1);
result = the selected line.