语言

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 值,表示可以显示的文本行。

示例

下面的示例演示如何使用 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 显著性能影响的应用程序中提高性能。

适用于