Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this.TextBlock.Width = document.CurrentPage.Content.ActualWidth;
- this.TextBlock.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
- Window w = new Window();
- w.Content = this.TextBlock;
- w.Show();
- Drawing textBlockDrawing = VisualTreeHelper.GetDrawing(this.TextBlock);
- List<String> list = new List<String>();
- WalkDrawingForText(list, textBlockDrawing);
- private static void WalkDrawingForText(List<String> list, Drawing d)
- {
- var glyphs = d as GlyphRunDrawing;
- if (glyphs != null)
- {
- list.Add(new string(glyphs.GlyphRun.Characters.ToArray()));
- }
- else
- {
- var g = d as DrawingGroup;
- if (g != null)
- {
- foreach (Drawing child in g.Children)
- {
- WalkDrawingForText(sb, child);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement