本文整理汇总了C#中ITextPointer.MoveToLineBoundary方法的典型用法代码示例。如果您正苦于以下问题:C# ITextPointer.MoveToLineBoundary方法的具体用法?C# ITextPointer.MoveToLineBoundary怎么用?C# ITextPointer.MoveToLineBoundary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITextPointer
的用法示例。
在下文中一共展示了ITextPointer.MoveToLineBoundary方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MovePositionByUnits
//.........这里部分代码省略.........
{
moved++;
}
else
{
position.MoveToPosition(positionOrig);
break;
}
}
// Adjust logical direction to point to the following text (forward or backward movement).
// If we don't do this, we'll normalize in the wrong direction and get stuck in a loop
// if caller tries to advance again.
position.SetLogicalDirection(LogicalDirection.Forward);
break;
case TextUnit.Line:
// Position is snapped to nearest line boundary. But since line information
// is based on the layout, position is not changed, if:
// a) it is not currently in the view, or
// b) containing line cannot be found.
textView = _textAdaptor.GetUpdatedTextView();
if (textView != null && textView.IsValid && textView.Contains(position))
{
// ITextPointer.MoveToLineBoundary can't handle Table row end positions.
// Mimic TextEditor's caret navigation code and move into the preceding
// TableCell.
if (TextPointerBase.IsAtRowEnd(position))
{
position.MoveToNextInsertionPosition(LogicalDirection.Backward);
}
moved = position.MoveToLineBoundary(count);
MoveToInsertionPosition(position, LogicalDirection.Forward);
if (moved < 0)
{
moved = -moved; // Will be reversed below.
}
}
break;
case TextUnit.Paragraph:
// Utilize TextRange logic to determine paragraph boundaries.
ITextRange paragraphRange = new TextRange(position, position);
paragraphRange.SelectParagraph(position);
while (moved < absCount)
{
position.MoveToPosition(direction == LogicalDirection.Forward ? paragraphRange.End : paragraphRange.Start);
if (!position.MoveToNextInsertionPosition(direction))
{
break;
}
moved++;
paragraphRange.SelectParagraph(position);
position.MoveToPosition(paragraphRange.Start); // Position it always at the beginning of the paragraph.
}
break;
case TextUnit.Page:
// But since page information is based on the layout, position is not changed, if:
// a) it is not currently in the view, or
// b) containing page cannot be found.
// Page movement is possible only in multi-page scenario.