TextFormatter.FormatLine 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
建立 TextLine 一個用於格式化與顯示文件內容的 。
多載
| 名稱 | Description |
|---|---|
| FormatLine(TextSource, Int32, Double, TextParagraphProperties, TextLineBreak) |
建立 TextLine 一個用於格式化與顯示文件內容的 。 |
| FormatLine(TextSource, Int32, Double, TextParagraphProperties, TextLineBreak, TextRunCache) |
建立 TextLine 一個用於格式化與顯示文件內容的 。 |
FormatLine(TextSource, Int32, Double, TextParagraphProperties, TextLineBreak)
建立 TextLine 一個用於格式化與顯示文件內容的 。
public:
abstract System::Windows::Media::TextFormatting::TextLine ^ FormatLine(System::Windows::Media::TextFormatting::TextSource ^ textSource, int firstCharIndex, double paragraphWidth, System::Windows::Media::TextFormatting::TextParagraphProperties ^ paragraphProperties, System::Windows::Media::TextFormatting::TextLineBreak ^ previousLineBreak);
public abstract System.Windows.Media.TextFormatting.TextLine FormatLine(System.Windows.Media.TextFormatting.TextSource textSource, int firstCharIndex, double paragraphWidth, System.Windows.Media.TextFormatting.TextParagraphProperties paragraphProperties, System.Windows.Media.TextFormatting.TextLineBreak previousLineBreak);
abstract member FormatLine : System.Windows.Media.TextFormatting.TextSource * int * double * System.Windows.Media.TextFormatting.TextParagraphProperties * System.Windows.Media.TextFormatting.TextLineBreak -> System.Windows.Media.TextFormatting.TextLine
Public MustOverride Function FormatLine (textSource As TextSource, firstCharIndex As Integer, paragraphWidth As Double, paragraphProperties As TextParagraphProperties, previousLineBreak As TextLineBreak) As TextLine
參數
- textSource
- TextSource
一個 TextSource 代表該行文字來源的值。
- paragraphProperties
- TextParagraphProperties
一個 TextParagraphProperties 代表段落屬性的值,例如流向、對齊或縮排。
- previousLineBreak
- TextLineBreak
一個 TextLineBreak 指定文字格式化狀態的值,指的是段落中前一行因文字格式化而中斷的位置。
傳回
代表 TextLine 一行可顯示的文字的值。
範例
以下範例說明如何使用此 FormatLine 方法回傳格式化的 TextLine。
// Create a textline from the text store using the TextFormatter object.
TextLine myTextLine = formatter.FormatLine(
customTextSource,
0,
400,
customTextParagraphProperties,
null);
// Draw the formatted text into the drawing context.
myTextLine.Draw(drawingContext, new Point(0, 0), InvertAxes.None);
' Create a textline from the text store using the TextFormatter object.
Dim myTextLine As TextLine = formatter.FormatLine(customTextSource, 0, 400, customTextParagraphProperties, Nothing)
' Draw the formatted text into the drawing context.
myTextLine.Draw(drawingContext, New Point(0, 0), InvertAxes.None)
適用於
FormatLine(TextSource, Int32, Double, TextParagraphProperties, TextLineBreak, TextRunCache)
建立 TextLine 一個用於格式化與顯示文件內容的 。
public:
abstract System::Windows::Media::TextFormatting::TextLine ^ FormatLine(System::Windows::Media::TextFormatting::TextSource ^ textSource, int firstCharIndex, double paragraphWidth, System::Windows::Media::TextFormatting::TextParagraphProperties ^ paragraphProperties, System::Windows::Media::TextFormatting::TextLineBreak ^ previousLineBreak, System::Windows::Media::TextFormatting::TextRunCache ^ textRunCache);
public abstract System.Windows.Media.TextFormatting.TextLine FormatLine(System.Windows.Media.TextFormatting.TextSource textSource, int firstCharIndex, double paragraphWidth, System.Windows.Media.TextFormatting.TextParagraphProperties paragraphProperties, System.Windows.Media.TextFormatting.TextLineBreak previousLineBreak, System.Windows.Media.TextFormatting.TextRunCache textRunCache);
abstract member FormatLine : System.Windows.Media.TextFormatting.TextSource * int * double * System.Windows.Media.TextFormatting.TextParagraphProperties * System.Windows.Media.TextFormatting.TextLineBreak * System.Windows.Media.TextFormatting.TextRunCache -> System.Windows.Media.TextFormatting.TextLine
Public MustOverride Function FormatLine (textSource As TextSource, firstCharIndex As Integer, paragraphWidth As Double, paragraphProperties As TextParagraphProperties, previousLineBreak As TextLineBreak, textRunCache As TextRunCache) As TextLine
參數
- textSource
- TextSource
一個 TextSource 代表該行文字來源的物件。
- paragraphProperties
- TextParagraphProperties
一個 TextParagraphProperties 代表段落屬性的物件,例如流向、對齊或縮排。
- previousLineBreak
- TextLineBreak
一個 TextLineBreak 物件,用來指定文字格式化狀態,根據段落中前一行被文字格式化過程中斷開的位置。
- textRunCache
- TextRunCache
一個 TextRunCache 代表文字版面快取機制的物件。
傳回
代表 TextLine 一行可顯示的文字的值。
備註
此方法用於提升效能,適用於對效能有重大影響的應用 TextLine 。