// Create a new Run object with text and font properties Run run = new Run("Hello World!"); run.FontFamily = new FontFamily("Arial"); run.FontSize = 16;
// Add the Run to a Paragraph object and add that Paragraph to a FlowDocument object Paragraph paragraph = new Paragraph(run); FlowDocument document = new FlowDocument(paragraph); myRichTextBox.Document = document;This example creates a new Paragraph object and adds the Run object created in the first example to it. Then, a new FlowDocument is created with the Paragraph object, and that document is set as the content of a RichTextBox control. The package library for System.Windows.Documents is part of the .NET Framework, specifically the Windows Presentation Foundation (WPF) library.