語言

Run 建構函式

定義

初始化 Run 類別的新執行個體。

多載

名稱 Description
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 A 指定插入位置,在建立後插入文字執行,或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)

適用於