Partager via


ITextSelection Interface

Represents the selected text in an ITextView.

Namespace:  Microsoft.VisualStudio.Text.Editor
Assembly:  Microsoft.VisualStudio.Text.UI (in Microsoft.VisualStudio.Text.UI.dll)

Syntax

'Declaration
Public Interface ITextSelection
public interface ITextSelection
public interface class ITextSelection
type ITextSelection =  interface end
public interface ITextSelection

The ITextSelection type exposes the following members.

Properties

  Name Description
Public property ActivationTracksFocus Determines whether IsActive should track when the ITextView gains and loses aggregate focus. The default is true.
Public property ActivePoint Gets the active point of the selection.
Public property AnchorPoint Gets the anchor point of the selection.
Public property End Gets the end point of the selection.
Public property IsActive Whether or not the selection is active.
Public property IsEmpty Determines whether the selection is zero length.
Public property IsReversed Determines whether the active point is Span.Start and the anchor point is Span.End.
Public property Mode Gets or sets the selection mode.
Public property SelectedSpans The currently-selected spans.
Public property Start Gets the start point of the selection.
Public property StreamSelectionSpan Gets the current selection as if it were a stream selection, regardless of the current selection mode.
Public property TextView Gets the text view to which this selection belongs.
Public property VirtualSelectedSpans The currently-selected spans, as VirtualSnapshotSpan objects.

Top

Methods

  Name Description
Public method Clear Makes the selection zero length, with a start and end position at the logical end of the current selection.
Public method GetSelectionOnTextViewLine Get the selection on the specified ITextViewLine.
Public method Select(SnapshotSpan, Boolean) Selects the text in the specified selection span.
Public method Select(VirtualSnapshotPoint, VirtualSnapshotPoint) Selects the text between the two VirtualSnapshotPoint objects.

Top

Events

  Name Description
Public event SelectionChanged Occurs when Select or Clear are called, as well as when the selection is empty and the caret is moved. The sender of the event is this ITextSelection.

Top

See Also

Reference

Microsoft.VisualStudio.Text.Editor Namespace