New to Telerik UI for WinForms? Start a free 30-day trial

This class handles the mouse selection in RadRichTextEditor.

Definition

Namespace:Telerik.WinForms.Documents.Selection

Assembly:Telerik.WinControls.RichTextEditor.dll

Syntax:

C#
public class MouseSelectionHandler

Inheritance: objectMouseSelectionHandler

Constructors

Creates a mouse-selection handler for the specified document and presenter.

C#
public MouseSelectionHandler(RadDocument document, IDocumentEditorPresenter presenter)
Parameters:documentRadDocument

The document whose selection and positions are managed.

presenterIDocumentEditorPresenter

The presenter that receives mouse input and displays the selection.

Fields

This maximum time between click that is considered double click.

C#
public static double DoubleClickTime

The number of pixels that is acceptable for the mouse to move when doble clicking.

C#
public static int MouseDoubleClickThreshold

The number of pixels that is considered a drag operation.

C#
public static int MouseDragThreshold

Properties

Gets the current document position targeted by a selected-content drag.

C#
public DocumentPosition DropPosition { get; }

Gets whether a click-based selection gesture is in progress.

C#
public bool IsClickSelecting { get; }

Gets whether a selection, selected-content, or table drag is in progress.

C#
public bool IsDragging { get; }

Gets whether the current drag is moving selected content to another document position.

C#
public bool IsMoveSelectionDragging { get; }

Gets whether the handler is tracking mouse input for a selection gesture.

C#
public bool IsTracking { get; }

Methods

Clears the selection and resets the mouse-gesture state.

C#
public bool CancelSelection()
Returns:

bool

true if a non-empty selection was cleared; otherwise, false.

Clears the current selection after a caret move when no mouse gesture or Shift-based selection is active.

C#
public void HandleDocumentCaretPositionChanged(bool ctrlPressed, bool shiftPressed)
Parameters:ctrlPressedbool

Whether Ctrl is held; this value is not used by this handler.

shiftPressedbool

Whether Shift is held to extend the current selection.

Raises the SelectionDragged event.

C#
protected virtual void OnSelectionDragged(SelectionDragEventArgs e)
Parameters:eSelectionDragEventArgs

The drop position for the dragged selection.

Starts tracking a mouse press and initializes selection behavior at the specified position. Repeated presses are handled as word- or paragraph-selection gestures.

C#
public virtual void RegisterDocumentMouseDown(bool ctrlPressed, bool shiftPressed, Point position, UIElement originalSource = null, SourceType source = SourceType.Mouse)
Parameters:ctrlPressedbool

Whether Ctrl is held; this affects whether the existing selection is retained.

shiftPressedbool

Whether Shift is held to extend the selection from its current anchor.

positionPoint

The pointer position in presenter coordinates.

originalSourceUIElement

The UI element under the pointer, if available; the single-press path uses it before hit-testing position.

sourceSourceType

The input source that generated the press.

Updates the tracked pointer position and advances an active selection or selected-content drag.

C#
public virtual void RegisterDocumentMouseMove(Point position, SourceType source = SourceType.Mouse)
Parameters:positionPoint

The pointer position in presenter coordinates.

sourceSourceType

The input source; this handler does not branch on this value.

Updates selection state for a right-button press, selecting a drawing under the pointer or clearing an existing drawing selection.

C#
public virtual void RegisterDocumentMouseRightButtonDown(UIElement originalSource, SourceType source = SourceType.Mouse)
Parameters:originalSourceUIElement

The UI element under the pointer, if available.

sourceSourceType

The input source; this handler does not branch on this value.

Completes the current mouse gesture, releases mouse capture, and updates selection and caret state. Touch input also restores selection markers.

C#
public virtual void RegisterDocumentMouseUp(SourceType source = SourceType.Mouse, Point? position = null)
Parameters:sourceSourceType

The input source; touch input causes selection markers to be shown.

positionPoint?

An optional release position used to update the caret when the release occurs within the selection.

Processes a repeated press by selecting a word or paragraph; Ctrl affects which selection granularity is chosen.

C#
protected virtual void RegisterDocumentMultipleMouseDown(bool ctrlPressed, bool shiftPressed, Point position)
Parameters:ctrlPressedbool

Whether Ctrl is held, which affects the repeated-click selection sequence.

shiftPressedbool

Whether Shift is held; this parameter is not used by the repeated-click handler.

positionPoint

The pointer position in presenter coordinates.

Processes a single press, including drawing selection and initializing mouse-drag tracking.

C#
protected virtual void RegisterDocumentSingleMouseDown(bool ctrlPressed, bool shiftPressed, Point position, UIElement originalSource)
Parameters:ctrlPressedbool

Whether Ctrl is held to retain the existing selection.

shiftPressedbool

Whether Shift is held to extend the selection.

positionPoint

The pointer position in presenter coordinates.

originalSourceUIElement

The UI element under the pointer, if available.

Events

Occurs when dragged selected content is released at a valid position outside the current selection.

C#
public event EventHandler<SelectionDragEventArgs> SelectionDragged