Επεξεργασία

Κοινή χρήση μέσω


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.

public:
 RichTextBox();
public RichTextBox ();
Public Sub New ()

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

RichTextBox(FlowDocument)

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

public:
 RichTextBox(System::Windows::Documents::FlowDocument ^ document);
public RichTextBox (System.Windows.Documents.FlowDocument document);
new System.Windows.Controls.RichTextBox : System.Windows.Documents.FlowDocument -> System.Windows.Controls.RichTextBox
Public Sub New (document As FlowDocument)

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.

// 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);
' Create a simple FlowDocument to serve as the content input for the construtor.
Dim flowDoc As New FlowDocument(New Paragraph(New Run("Simple FlowDocument")))
' After this constructor is called, the new RichTextBox rtb will contain flowDoc.
Dim rtb As New RichTextBox(flowDoc)

Applies to