TextSelection.AnchorPoint Propriedade

Definição

Obtém o ponto de origem da seleção.

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

Valor da propriedade

VirtualPoint

Um objeto VirtualPoint.

Atributos

Exemplos

Sub AnchorPointExample()  
    ' Before running this example, open a text document.  
    Dim objSel As TextSelection = DTE.ActiveDocument.Selection  
    Dim objAnchor As VirtualPoint = objSel.AnchorPoint  
    ' objAnchor is "live", tied to the position of the actual selection,   
    ' so it will reflect any changes. iCol and iRow are created here to   
    ' save a "snapshot" of the anchor point's position at this time.  
    Dim iCol As Long = objAnchor.DisplayColumn  
    Dim iRow As Long = objAnchor.Line  
    ' As the selection is extended, the active point moves but the anchor   
    ' point remains in place.  
    objSel.StartOfDocument(True)  
    objSel.EndOfDocument(True)  

    If (iCol = objAnchor.DisplayColumn And iRow = objAnchor.Line) Then  
        MsgBox("The anchor point has remained in place at row " & iRow & ", display column " & iCol)  
    End If  
End Sub  

Comentários

Embora os TextPoint objetos indiquem o local da seleção de texto na janela do Editor , eles não marcam o local no buffer. Espaço virtual — a área além do final da linha — também é controlada apenas na janela do Editor . Consequentemente, quando você usa um EditPoint no buffer de texto para modificar o texto, o que acontece com a seleção de texto não é definido. Por exemplo, um comando pode começar com seleção de texto, obter pontos de edição e, em seguida, alterar o buffer. Para garantir que a seleção de texto esteja em um determinado local, você deve inserir explicitamente a seleção de texto nesse local no final do comando.

Aplica-se a