//returns [0]=Rect of char at end of first line, [1]=Rect of char at start of second line
Rect[] FindStartEndOfVisualLineRects(int start, Rect startRect)
{
int next = start, len = tb.Text.Length;
Rect nextRect, prevRect = startRect;
while ((next = start + 1) < len)
{
nextRect = tb.GetRectFromCharacterIndex(next); //next.GetCharacterRect(LogicalDirection.Forward);
if (nextRect.Top != startRect.Top)
{
return new Rect[2] {
prevRect, nextRect
}
}
;
prevRect = nextRect;
}
return(null);
}