TextPointer.GetNextInsertionPosition(LogicalDirection) 方法     
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回一个指向指定逻辑方向上的下一个插入位置的 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。
示例
以下示例演示了此方法的用法。 该示例使用GetNextInsertionPosition此方法遍历内容元素边界,以便计算两个指定TextPointer实例之间存在的元素数Paragraph。
// 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 标记之间的位置 (,即在上一段的结束标记与下一段的开始标记之间) 。