共用方式為


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)

適用於