TextFormatter.FormatLine Method

Definition

Creates a TextLine that is used for formatting and displaying document content.

Overloads

FormatLine(TextSource, Int32, Double, TextParagraphProperties, TextLineBreak)

Creates a TextLine that is used for formatting and displaying document content.

FormatLine(TextSource, Int32, Double, TextParagraphProperties, TextLineBreak, TextRunCache)

Creates a TextLine that is used for formatting and displaying document content.

FormatLine(TextSource, Int32, Double, TextParagraphProperties, TextLineBreak)

Creates a TextLine that is used for formatting and displaying document content.

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

Parameters

textSource
TextSource

A TextSource value that represents the text source for the line.

firstCharIndex
Int32

An Int32 value that specifies the character index of the starting character in the line.

paragraphWidth
Double

A Double value that specifies the width of the paragraph that the line fills.

paragraphProperties
TextParagraphProperties

A TextParagraphProperties value that represents paragraph properties, such as flow direction, alignment, or indentation.

previousLineBreak
TextLineBreak

A TextLineBreak value that specifies the text formatter state, in terms of where the previous line in the paragraph was broken by the text formatting process.

Returns

A TextLine value that represents a line of text that can be displayed.

Examples

The following example shows how to use the FormatLine method to return a formatted 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)

Applies to

FormatLine(TextSource, Int32, Double, TextParagraphProperties, TextLineBreak, TextRunCache)

Creates a TextLine that is used for formatting and displaying document content.

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

Parameters

textSource
TextSource

A TextSource object that represents the text source for the line.

firstCharIndex
Int32

An Int32 value that specifies the character index of the starting character in the line.

paragraphWidth
Double

A Double value that specifies the width of the paragraph that the line fills.

paragraphProperties
TextParagraphProperties

A TextParagraphProperties object that represents paragraph properties, such as flow direction, alignment, or indentation.

previousLineBreak
TextLineBreak

A TextLineBreak object that specifies the text formatter state, in terms of where the previous line in the paragraph was broken by the text formatting process.

textRunCache
TextRunCache

A TextRunCache object that represents the caching mechanism for the layout of text.

Returns

A TextLine value that represents a line of text that can be displayed.

Remarks

This method is used to improve performance in applications where the TextLine has significant performance implications.

Applies to