편집

다음을 통해 공유


TextPointer.GetLineStartPosition Method

Definition

Returns a TextPointer to the beginning of a line that is specified relative to the current TextPointer.

Overloads

GetLineStartPosition(Int32)

Returns a TextPointer to the beginning of a line that is specified relative to the current TextPointer.

GetLineStartPosition(Int32, Int32)

Returns a TextPointer to the beginning of a line that is specified relative to the current TextPointer, and reports how many lines were skipped.

GetLineStartPosition(Int32)

Returns a TextPointer to the beginning of a line that is specified relative to the current TextPointer.

public:
 System::Windows::Documents::TextPointer ^ GetLineStartPosition(int count);
public System.Windows.Documents.TextPointer GetLineStartPosition (int count);
member this.GetLineStartPosition : int -> System.Windows.Documents.TextPointer
Public Function GetLineStartPosition (count As Integer) As TextPointer

Parameters

count
Int32

The number of start-of-line markers to skip when determining the line for which to return the starting position. Negative values specify preceding lines, 0 specifies the current line, and positive values specify following lines.

Returns

A TextPointer pointing to the beginning of the specified line (with the LogicalDirection set to Forward), or null if the specified line is out of range or otherwise cannot be located.

Remarks

If the TextPointer points to an ambiguous position, for example, between two lines, the line in the direction specified by LogicalDirection is selected as the relative starting line.

The operation performed by this method depends on a valid layout. When necessary, this method attempts to automatically regenerate a valid layout before proceeding with the operation. Regenerating a layout can be a relatively expensive operation. Use HasValidLayout to check for a valid layout before performing operations that may regenerate the layout. For more information, see Layout.

Applies to

GetLineStartPosition(Int32, Int32)

Returns a TextPointer to the beginning of a line that is specified relative to the current TextPointer, and reports how many lines were skipped.

public:
 System::Windows::Documents::TextPointer ^ GetLineStartPosition(int count, [Runtime::InteropServices::Out] int % actualCount);
public System.Windows.Documents.TextPointer GetLineStartPosition (int count, out int actualCount);
member this.GetLineStartPosition : int * int -> System.Windows.Documents.TextPointer
Public Function GetLineStartPosition (count As Integer, ByRef actualCount As Integer) As TextPointer

Parameters

count
Int32

The number of start-of-line markers to skip when determining the line for which to return the starting position. Negative values specify preceding lines, 0 specifies the current line, and positive values specify following lines.

actualCount
Int32

When this method returns, contains the actual number of start-of-line markers that were skipped when determining the line for which to return the starting position. This value may be less than count if the beginning or end of content is encountered before the specified number of lines are skipped. This parameter is passed uninitialized.

Returns

A TextPointer pointing to the beginning of the specified line (with the LogicalDirection set to Forward), or to the beginning of the line closest to the specified line if the specified line is out of range.

Remarks

If the TextPointer points to an ambiguous position, for example, between two lines, the line in the direction specified by the LogicalDirection property is selected as the relative starting line.

Applies to