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 요청된 방향에서 다음 삽입 위치를 식별하거나 null 다음 삽입 위치를 찾을 수 없는 경우를 식별하는 A입니다.

예제

다음 예제에서는이 메서드에 대 한 사용을 보여 줍니다. 이 예제에서는 지정된 TextPointer 두 인스턴스 사이에 있는 요소 수를 Paragraph 계산하기 위해 메서드를 사용하여 GetNextInsertionPosition 콘텐츠 요소 경계를 트래버스합니다.

// 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 태그(즉, 이전 단락의 닫는 태그와 다음 단락의 여는 태그 사이) 사이의 위치입니다.

적용 대상

추가 정보