TextPointer.GetNextInsertionPosition(LogicalDirection) 메서드

정의

지정된 논리 방향의 다음 삽입 위치에 대한 TextPointer를 반환합니다.

public:
 System::Windows::Documents::TextPointer ^ GetNextInsertionPosition(System::Windows::Documents::LogicalDirection direction);
public System.Windows.Documents.TextPointer GetNextInsertionPosition (System.Windows.Documents.LogicalDirection direction);
member this.GetNextInsertionPosition : System.Windows.Documents.LogicalDirection -> System.Windows.Documents.TextPointer
Public Function GetNextInsertionPosition (direction As LogicalDirection) As TextPointer

매개 변수

direction
LogicalDirection

다음 삽입 위치를 검색할 논리 방향을 지정하는 LogicalDirection 값 중 하나입니다.

반환

TextPointer

요청한 방향의 다음 삽입 위치를 식별하는 TextPointer입니다. 다음 삽입 위치를 찾을 수 없는 경우 null입니다.

예제

다음 예제는이 메서드의 사용 방법을 보여 줍니다. 이 예제에서는 사용 합니다 GetNextInsertionPosition 개수를 계산 하기 위해 콘텐츠 요소 경계를 통과 하는 방법 Paragraph 지정 된 두 요소를 제공 TextPointer 인스턴스.

// This method returns the number of pagragraphs between two
// specified TextPointers.
int GetParagraphCount(TextPointer start, TextPointer end)
{
    int paragraphCount = 0;
 
    while (start != null && start.CompareTo(end) < 0)
    {
        Paragraph paragraph = start.Paragraph;
 
        if (paragraph != null)
        {
            paragraphCount++;
 
            // Advance start to the end of the current paragraph.
            start = paragraph.ContentEnd;
         }
 
         // Use the GetNextInsertionPosition method to skip over any interceding
         // content element tags.
         start = start.GetNextInsertionPosition(LogicalDirection.Forward);
     } // End while.
 
         return paragraphCount;
}  // End GetParagraphCount.
' This method returns the number of pagragraphs between two
' specified TextPointers.
Private Function GetParagraphCount(ByVal start As TextPointer, ByVal [end] As TextPointer) As Integer
    Dim paragraphCount As Integer = 0

    Do While start IsNot Nothing AndAlso start.CompareTo([end]) < 0
        Dim paragraph As Paragraph = start.Paragraph

        If paragraph IsNot Nothing Then
            paragraphCount += 1

            ' Advance start to the end of the current paragraph.
            start = paragraph.ContentEnd
        End If

        ' Use the GetNextInsertionPosition method to skip over any interceding
        ' content element tags.
        start = start.GetNextInsertionPosition(LogicalDirection.Forward)

    Loop ' End while.

    Return paragraphCount

End Function ' End GetParagraphCount.

설명

삽입 위치 는 관련된 콘텐츠에 대 한 의미 체계 규칙을 위반 하지 않고 새 콘텐츠를 추가할 수 있는 위치입니다. 실제로 삽입 위치는 콘텐츠 내 캐럿을 배치할 수 있습니다. 유효한 예가 TextPointer 삽입 위치 하지 않은 위치는 두 인접 한 위치 Paragraph 태그 (즉, 여는 태그 다음 단락의 이전 단락의 닫는 태그 사이).

적용 대상

추가 정보