本文整理汇总了C#中System.Windows.Documents.TextEditor.CancelExtendSelection方法的典型用法代码示例。如果您正苦于以下问题:C# TextEditor.CancelExtendSelection方法的具体用法?C# TextEditor.CancelExtendSelection怎么用?C# TextEditor.CancelExtendSelection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Documents.TextEditor
的用法示例。
在下文中一共展示了TextEditor.CancelExtendSelection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnMouseMoveWithFocus
// MouseMoveEvent handler.
private static void OnMouseMoveWithFocus(TextEditor This, MouseEventArgs e)
{
// Ignore the event if it was caused by us capturing the mouse
if (This._mouseCapturingInProgress)
{
return;
}
// Clear a flag indicating that Shift key was pressed without any following key
// This flag is necessary for KeyUp(RightShift/LeftShift) processing.
TextEditor._ThreadLocalStore.PureControlShift = false;
// Get the mouse move point.
Point mouseMovePoint = e.GetPosition(This.TextView.RenderScope);
// Update mouse cursor shape
TextEditorMouse.UpdateCursor(This, mouseMovePoint);
// For bug 1547567, remove when resolved.
Invariant.Assert(This.Selection != null);
// We're only interested in moves when the left button is down.
if (e.LeftButton != MouseButtonState.Pressed)
{
return;
}
// We didn't get the original mouse down event, perhaps a listener
// handled it.
if (!This.UiScope.IsMouseCaptured)
{
return;
}
// Scale back any background layout in progress.
This.TextView.ThrottleBackgroundTasksForUserInput();
if (This._tableColResizeInfo != null)
{
This._tableColResizeInfo.UpdateAdorner(mouseMovePoint);
}
else
{
// Consider event handled
e.Handled = true;
// For bug 1547567, remove when resolved.
Invariant.Assert(This.Selection != null);
// Find a text position for this mouse point
ITextPointer snappedCursorPosition = This.TextView.GetTextPositionFromPoint(mouseMovePoint, /*snapToText:*/true);
// For bug 1547567, remove when resolved.
Invariant.Assert(This.Selection != null);
if (snappedCursorPosition == null)
{
This.RequestExtendSelection(mouseMovePoint);
}
else
{
This.CancelExtendSelection();
// For bug 1547567, remove when resolved.
Invariant.Assert(This.Selection != null);
if (!This._dragDropProcess.SourceOnMouseMove(mouseMovePoint))
{
// Auto-scrolling behavior during selection guesture -
// works when the mouse is outside of scroller's viewport.
// In such case we artificially increase coordinates to
// get to farther text position - which would speed-up scrolling
// in particular direction.
FrameworkElement scroller = This._Scroller;
if (scroller != null && This.UiScope is TextBoxBase)
{
ITextPointer acceleratedCursorPosition = null; // cursorPosition corrected to accelerate scrolling
Point targetPoint = new Point(mouseMovePoint.X, mouseMovePoint.Y);
Point pointScroller = e.GetPosition((IInputElement)scroller);
double pageHeight = (double)((TextBoxBase)This.UiScope).ViewportHeight;
double slowAreaDelta = ScrollViewer._scrollLineDelta;
// Auto scrolling up/down page for the page height if the mouse Y
// position is out of viewport.
if (pointScroller.Y < 0 - slowAreaDelta)
{
Rect targetRect = This.TextView.GetRectangleFromTextPosition(snappedCursorPosition);
targetPoint = new Point(targetPoint.X, targetRect.Bottom - pageHeight);
acceleratedCursorPosition = This.TextView.GetTextPositionFromPoint(targetPoint, /*snapToText:*/true);
}
else if (pointScroller.Y > pageHeight + slowAreaDelta)
{
Rect targetRect = This.TextView.GetRectangleFromTextPosition(snappedCursorPosition);
targetPoint = new Point(targetPoint.X, targetRect.Top + pageHeight);
acceleratedCursorPosition = This.TextView.GetTextPositionFromPoint(targetPoint, /*snapToText:*/true);
}
//.........这里部分代码省略.........