Uredi

Deli z drugimi prek


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.

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

Applies to

Run(String)

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

public:
 Run(System::String ^ text);
public Run (string text);
new System.Windows.Documents.Run : string -> System.Windows.Documents.Run
Public Sub New (text As String)

Parameters

text
String

A string specifying the initial contents of the Run object.

Examples

The following example demonstrates the use of this constructor.

Run textRun = new Run("The text contents of this text run.");
Dim textRun As New Run("The text contents of this text run.")

Applies to

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.

public:
 Run(System::String ^ text, System::Windows::Documents::TextPointer ^ insertionPosition);
public Run (string text, System.Windows.Documents.TextPointer insertionPosition);
new System.Windows.Documents.Run : string * System.Windows.Documents.TextPointer -> System.Windows.Documents.Run
Public Sub New (text As String, insertionPosition As TextPointer)

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.

// 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);
    ' Create a new, empty paragraph to host the text run.
    Dim par As New Paragraph()

    ' Get a TextPointer for the end of content in the paragraph.
    Dim insertionPoint As TextPointer = 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).
Dim textRun2 As New Run("The text contents of this text run.", insertionPoint)

Applies to