共用方式為


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)

適用於