如果我有这样的代码:
FormattedText text = new FormattedText(sTheBook,
System.Globalization.CultureInfo.CurrentUICulture,
System.Windows.FlowDirection.LeftToRight,
new Typeface("Times New Roman"),
13, Brushes.Black);
text.MaxTextWidth = 300;
text.MaxTextHeight = 600;
text.TextAlignment = TextAlignment.Justify;
dc.DrawText(text, new Point(10, 0));
...那么,如果它很长,那么屏幕上只会显示我(通过 sTheBook)传入的一些文本。我需要知道显示了多少,以便稍后显示其余部分!我可以轻松地测量大量文本,但是通过一遍又一遍地渲染和重新渲染我的文本直到找到完全适合的部分来进行搜索似乎很愚蠢。
如果它具有此功能,我愿意使用其他一些 WPF 文本呈现技术。
谢谢!