RichTextBox Constructors

Definition

Initializes a new instance of the RichTextBox class.

Overloads

RichTextBox()

Initializes a new, default instance of the RichTextBox class.

RichTextBox(FlowDocument)

Initializes a new instance of the RichTextBox class, adding a specified FlowDocument as the initial content.

RichTextBox()

Initializes a new, default instance of the RichTextBox class.

C#
public RichTextBox();

Remarks

This constructor creates an empty FlowDocument that is associated with the Document property. Specifically, the empty FlowDocument contains a single Paragraph, which contains a single Run which contains no text.

Applies to

.NET Framework 4.8.1 dan versi lain
Produk Versi
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

RichTextBox(FlowDocument)

Initializes a new instance of the RichTextBox class, adding a specified FlowDocument as the initial content.

C#
public RichTextBox(System.Windows.Documents.FlowDocument document);

Parameters

document
FlowDocument

A FlowDocument to be added as the initial contents of the new RichTextBox.

Examples

The following example illustrates use of this constructor.

C#
// Create a simple FlowDocument to serve as the content input for the construtor.
FlowDocument flowDoc = new FlowDocument(new Paragraph(new Run("Simple FlowDocument")));
// After this constructor is called, the new RichTextBox rtb will contain flowDoc.
RichTextBox rtb = new RichTextBox(flowDoc);

Applies to

.NET Framework 4.8.1 dan versi lain
Produk Versi
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10