void SyntaxHighlight_Loaded(object sender, RoutedEventArgs e) { if (_rtb == null) { _rtb = new C1RichTextBox { ReturnMode = ReturnMode.SoftLineBreak, TextWrapping = TextWrapping.NoWrap, IsReadOnly = false, Document = new C1Document { Background = new SolidColorBrush(Colors.White), FontFamily = new FontFamily("Courier New"), FontSize = 16, Blocks = { new C1Paragraph { Children = { new C1Run { Text = GetStringResource("w3c.htm") }, }, } } }, StyleOverrides = { _rangeStyles } }; LayoutRoot.Children.Add(_rtb); _rtb.TextChanged += tb_TextChanged; UpdateSyntaxColoring(_rtb.Document.ContentRange); } }
public C1RichTextBoxPaginator(C1RichTextBox rtb, Size pageSize, Thickness margin) { var mgr = new C1RichTextViewManager { Document = rtb.Document }; // PageSize, Margin and ContentSize PageSize = pageSize; _margin = margin; var contentSize = new Size(PageSize.Width - margin.Left - margin.Right, PageSize.Height - margin.Top - margin.Bottom); // print the pages outside the visual tree _pages = mgr.OfflinePaint(contentSize).ToList(); }