This documentation is archived and is not being maintained.

TextFormatter.FormatLine Method (TextSource, Int32, Double, TextParagraphProperties, TextLineBreak)

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

Namespace: System.Windows.Media.TextFormatting
Assembly: PresentationCore (in presentationcore.dll)

public abstract TextLine FormatLine (
	TextSource textSource,
	int firstCharIndex,
	double paragraphWidth,
	TextParagraphProperties paragraphProperties,
	TextLineBreak previousLineBreak
)
public abstract TextLine FormatLine (
	TextSource textSource, 
	int firstCharIndex, 
	double paragraphWidth, 
	TextParagraphProperties paragraphProperties, 
	TextLineBreak previousLineBreak
)
public abstract function FormatLine (
	textSource : TextSource, 
	firstCharIndex : int, 
	paragraphWidth : double, 
	paragraphProperties : TextParagraphProperties, 
	previousLineBreak : TextLineBreak
) : TextLine
You cannot use methods in XAML.

Parameters

textSource

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

firstCharIndex

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

paragraphWidth

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

paragraphProperties

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

previousLineBreak

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.

Return Value

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

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);

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Show: