private string GetNextRtf(float to) { var bottom = TwipsToPixels(to); using (var rtb = new RichTextBoxFixed()) { rtb.ContentsResized += ResizeBoxToContent; rtb.Width = TwipsToPixels(_computedSize.Width); rtb.SetRtfOrText(_control.Rtf ?? string.Empty); _lastChar = rtb.GetCharIndexFromPosition(new Point(0, bottom + rtb.PreferredHeight)); rtb.Select(_firstChar, _lastChar - _firstChar); _firstChar = _lastChar; return(rtb.SelectedRtf); } }
private string GetNextRtf(float to) { var bottom = TwipsToPixels(to); using (var rtb = new RichTextBoxFixed()) { rtb.ContentsResized += ResizeBoxToContent; rtb.Width = TwipsToPixels(_computedSize.Width); rtb.SetRtfOrText(_control.Rtf); var lastCharPoint = rtb.GetPositionFromCharIndex(rtb.TextLength - 1); var neededPoint = new Point(lastCharPoint.X, Math.Min(lastCharPoint.Y, bottom + rtb.PreferredHeight)); _lastChar = rtb.GetCharIndexFromPosition(neededPoint); rtb.Select(_firstChar, _lastChar - _firstChar); _firstChar = _lastChar; return(rtb.SelectedRtf); } }