Udostępnij za pośrednictwem


TextSelection.ActivePoint Property

Definition

Gets the current endpoint of the selection.

public:
 property EnvDTE::VirtualPoint ^ ActivePoint { EnvDTE::VirtualPoint ^ get(); };
public:
 property EnvDTE::VirtualPoint ^ ActivePoint { EnvDTE::VirtualPoint ^ get(); };
[System.Runtime.InteropServices.DispId(4)]
public EnvDTE.VirtualPoint ActivePoint { [System.Runtime.InteropServices.DispId(4)] get; }
[<System.Runtime.InteropServices.DispId(4)>]
[<get: System.Runtime.InteropServices.DispId(4)>]
member this.ActivePoint : EnvDTE.VirtualPoint
Public ReadOnly Property ActivePoint As VirtualPoint

Property Value

A VirtualPoint object.

Attributes

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  

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.

Applies to