TextSelection.ActivePoint Property
Gets the current endpoint of the selection.
Namespace: EnvDTE
Assembly: EnvDTE (in EnvDTE.dll)
Syntax
'Declaration
ReadOnly Property ActivePoint As VirtualPoint
'Usage
Dim instance As TextSelection
Dim value As VirtualPoint
value = instance.ActivePoint
VirtualPoint ActivePoint { get; }
property VirtualPoint^ ActivePoint {
VirtualPoint^ get ();
}
function get ActivePoint () : VirtualPoint
Property Value
Type: EnvDTE.VirtualPoint
A VirtualPoint object.
Remarks
Although TextPoint objects indicate the location of the selected text 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 selected text is not defined. For example, a command may start with selected text, get edit points, and then change the buffer. To guarantee the selected text is in a certain location, you must explicitly place the selected text 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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.