本文整理汇总了C#中System.Windows.Documents.TextPointer.GetAdjacentTextElementNodeSibling方法的典型用法代码示例。如果您正苦于以下问题:C# TextPointer.GetAdjacentTextElementNodeSibling方法的具体用法?C# TextPointer.GetAdjacentTextElementNodeSibling怎么用?C# TextPointer.GetAdjacentTextElementNodeSibling使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Documents.TextPointer
的用法示例。
在下文中一共展示了TextPointer.GetAdjacentTextElementNodeSibling方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InsertElementInternal
//.........这里部分代码省略.........
}
newElementNode = false;
}
else
{
// Allocate a node in the tree to hold the element.
elementText = null;
elementNode = new TextTreeTextElementNode();
deltaCharCount = 0;
newElementNode = true;
extractChangeEventArgs = null;
}
parentLogicalNode = startPosition.GetLogicalTreeNode();
// Invalidate any TextElementCollection that depends on the parent.
// Make sure we do that before raising any public events.
TextElementCollectionHelper.MarkDirty(parentLogicalNode);
// Link the TextElement to the TextElementNode.
if (newElementNode)
{
elementNode.TextElement = element;
element.TextElementNode = (TextTreeTextElementNode)elementNode;
}
// If the new element will become the parent of an old element,
// the old element may become a firstIMEVisibleSibling.
TextTreeTextElementNode newFirstIMEVisibleNode = null;
int newFirstIMEVisibleNodeCharDelta = 0;
if (scopesExistingContent)
{
newFirstIMEVisibleNode = startPosition.GetAdjacentTextElementNodeSibling(LogicalDirection.Forward);
if (newFirstIMEVisibleNode != null)
{
newFirstIMEVisibleNodeCharDelta = -newFirstIMEVisibleNode.IMELeftEdgeCharCount;
newFirstIMEVisibleNode.IMECharCount += newFirstIMEVisibleNodeCharDelta;
}
}
// Attach the element node.
childSymbolCount = InsertElementToSiblingTree(startPosition, endPosition, elementNode);
// Add the edge char count to our delta. We couldn't get this before
// because it depends on the position of the element in the tree.
deltaCharCount += elementNode.IMELeftEdgeCharCount;
TextTreeTextElementNode formerFirstIMEVisibleNode = null;
int formerFirstIMEVisibleNodeCharDelta = 0;
if (element.IsFirstIMEVisibleSibling && !scopesExistingContent)
{
formerFirstIMEVisibleNode = (TextTreeTextElementNode)elementNode.GetNextNode();
if (formerFirstIMEVisibleNode != null)
{
// The following node was the former first ime visible sibling.
// It just moved, and gains an edge character.
formerFirstIMEVisibleNodeCharDelta = formerFirstIMEVisibleNode.IMELeftEdgeCharCount;
formerFirstIMEVisibleNode.IMECharCount += formerFirstIMEVisibleNodeCharDelta;
}
}
// Ancester nodes gain the two edge symbols.
UpdateContainerSymbolCount(elementNode.GetContainingNode(), /* symbolCount */ elementText == null ? 2 : elementText.Length, deltaCharCount + formerFirstIMEVisibleNodeCharDelta + newFirstIMEVisibleNodeCharDelta);
symbolOffset = elementNode.GetSymbolOffset(this.Generation);