Run 构造函数

定义

初始化 Run 类的新实例。

重载

名称 说明
Run()

初始化类的新默认实例 Run

Run(String)

初始化类的新实例 Run ,以指定的字符串作为文本运行的初始内容。

Run(String, TextPointer)

初始化类的新实例 Run ,将指定的字符串作为文本运行的初始内容,并为 TextPointer 文本运行指定插入位置。

Run()

初始化类的新默认实例 Run

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

适用于

Run(String)

初始化类的新实例 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)

参数

text
String

一个字符串,指定对象的初始内容 Run

示例

以下示例演示如何使用此构造函数。

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

适用于

Run(String, TextPointer)

初始化类的新实例 Run ,将指定的字符串作为文本运行的初始内容,并为 TextPointer 文本运行指定插入位置。

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)

参数

text
String

一个字符串,指定对象的初始内容 Run

insertionPosition
TextPointer

TextPointer 个指定插入位置,用于插入文本在创建后运行,或者 null 不进行自动插入。

示例

以下示例演示如何使用此构造函数。

// 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)

适用于