Using a FormattedText object, how do I find out how much of my text was actually displayed?
- by Robert
If I have code like this:
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));
...then, if it is long, only some of the text that I passed in (via sTheBook) will be displayed on the screen. I need to know how much was displayed so I can display the rest later! I can easily measure an amount of text, but it seems silly to do a search by rendering and re-rendering my text over and over until I find the piece that fits exactly.
Thanks!