Run Constructors

Definition

Initializes a new instance of the Run class.

Overloads

Run()

Initializes a new, default instance of the Run class.

Run(String)

Initializes a new instance of the Run class, taking a specified string as the initial contents of the text run.

Run(String, TextPointer)

Initializes a new instance of the Run class, taking a specified string as the initial contents of the text run, and a TextPointer specifying an insertion position for the text run.

Run()

Initializes a new, default instance of the Run class.

C#
public Run();

Applies to

.NET Framework 4.8.1 a ďalšie verzie
Produkt Verzie
.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

Run(String)

Initializes a new instance of the Run class, taking a specified string as the initial contents of the text run.

C#
public Run(string text);

Parameters

text
String

A string specifying the initial contents of the Run object.

Examples

The following example demonstrates the use of this constructor.

C#
Run textRun = new Run("The text contents of this text run.");

Applies to

.NET Framework 4.8.1 a ďalšie verzie
Produkt Verzie
.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

Run(String, TextPointer)

Initializes a new instance of the Run class, taking a specified string as the initial contents of the text run, and a TextPointer specifying an insertion position for the text run.

C#
public Run(string text, System.Windows.Documents.TextPointer insertionPosition);

Parameters

text
String

A string specifying the initial contents of the Run object.

insertionPosition
TextPointer

A TextPointer specifying an insertion position at which to insert the text run after it is created, or null for no automatic insertion.

Examples

The following example demonstrates the use of this constructor.

C#
// Create a new, empty paragraph to host the text run.
Paragraph par = new Paragraph();

// Get a TextPointer for the end of content in the paragraph.
TextPointer insertionPoint = par.ContentEnd;

// This line will create a new text run, initialize it with the supplied string,
// and insert it at the specified insertion point (which happens to be the end of
// content for the host paragraph).
Run textRun = new Run("The text contents of this text run.", insertionPoint);

Applies to

.NET Framework 4.8.1 a ďalšie verzie
Produkt Verzie
.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