TextPointer.GetNextInsertionPosition(LogicalDirection) Yöntem
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Belirtilen mantıksal yönde sonraki ekleme konumuna bir TextPointer döndürür.
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
Parametreler
- direction
- LogicalDirection
Sonraki ekleme konumunun LogicalDirection arandığı mantıksal yönü belirten değerlerden biri.
Döndürülenler
TextPointer İstenen yönde bir sonraki ekleme konumunu tanımlayan veya null bir sonraki ekleme konumu bulunamıyorsa.
Örnekler
Aşağıdaki örnekte bu yöntem için bir kullanım gösterilmektedir. Örnek, belirtilen GetNextInsertionPosition iki örnek arasında mevcut öğe sayısını Paragraph saymak için içerik öğesi sınırları arasında geçiş yapmak için yöntemini kullanırTextPointer.
// 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.
Açıklamalar
Ekleme konumu, ilişkili içerik için herhangi bir semantik kuralı bozmadan yeni içeriğin eklenebileceği bir konumdur. Uygulamada ekleme konumu, içerikte bir şapka işaretinin konumlandırılabileceği herhangi bir yerdir. Ekleme konumu olmayan geçerli bir TextPointer konumuna örnek olarak, iki bitişik Paragraph etiketi (önceki paragrafın kapanış etiketi ile sonraki paragrafın açılış etiketi arasındaki) arasındaki konum verilebilir.