共用方式為


TextFormatter.FormatLine 方法

定義

建立用於格式化和顯示文件內容的 TextLine

多載

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 值,表示行的文字來源。

firstCharIndex
Int32

Int32 值,表示行中開始字元的字元索引。

paragraphWidth
Double

Double 值,表示填入行的段落寬度。

paragraphProperties
TextParagraphProperties

TextParagraphProperties 值,表示段落屬性,例如文字流向、對齊或縮排。

previousLineBreak
TextLineBreak

TextLineBreak 值,表示文字格式子狀態,是以文字格式化處理序在段落中前一行分行的位置來表示。

傳回

TextLine

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 物件,表示行的文字來源。

firstCharIndex
Int32

Int32 值,表示行中開始字元的字元索引。

paragraphWidth
Double

Double 值,表示填入行的段落寬度。

paragraphProperties
TextParagraphProperties

TextParagraphProperties 物件,表示段落屬性,例如文字流向、對齊或縮排。

previousLineBreak
TextLineBreak

TextLineBreak 物件,表示文字格式子狀態,是以文字格式化處理序在段落中前一行分行的位置來表示。

textRunCache
TextRunCache

TextRunCache 物件,表示文字配置的快取機制。

傳回

TextLine

TextLine 值,表示可以顯示的文字行。

備註

這個方法可用來改善具有 TextLine 顯著效能影響之應用程式中的效能。

適用於