Compartir a través de


TextSelection.ActivePoint Property

Gets the current endpoint of the selection.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

'Declaration
ReadOnly Property ActivePoint As VirtualPoint
VirtualPoint ActivePoint { get; }
property VirtualPoint^ ActivePoint {
    VirtualPoint^ get ();
}
abstract ActivePoint : VirtualPoint with get
function get ActivePoint () : VirtualPoint

Property Value

Type: EnvDTE.VirtualPoint
A VirtualPoint object.

Remarks

Although TextPoint objects indicate the location of the text selection in the Editor window, they do not mark the location in the buffer. Virtual space — the area beyond the end of the line — is also tracked only in the Editor window. Consequently, when you use an EditPoint object in the text buffer to modify text, what happens to the text selection is not defined. For example, a command may start with text selection, get edit points, and then change the buffer. To guarantee the text selection is in a certain location, you must explicitly place the text selection in that location at the end of your command.

Examples

Sub ActivePointExample()
   ' Before running this example, open a text document.
   Dim objSel As TextSelection = DTE.ActiveDocument.Selection
   Dim objActive As VirtualPoint = objSel.ActivePoint
   ' Collapse the selection to the beginning of the line.
   objSel.StartOfLine()
   ' objActive is "live", tied to the position of the actual selection, 
   ' so it will reflect the new position.
   Dim iCol As Long = objActive.DisplayColumn
   ' Move the selection to the end of the line.
   objSel.EndOfLine()

   MsgBox("The length of the insertion point line is " & (objActive.DisplayColumn - iCol) & " display characters.")
End Sub

.NET Framework Security

See Also

Reference

TextSelection Interface

EnvDTE Namespace