Propriedade TextSelection.AnchorPoint

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

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

Sintaxe

'Declaração
ReadOnly Property AnchorPoint As VirtualPoint
    Get
VirtualPoint AnchorPoint { get; }
property VirtualPoint^ AnchorPoint {
    VirtualPoint^ get ();
}
abstract AnchorPoint : VirtualPoint
function get AnchorPoint () : VirtualPoint

Valor de propriedade

Tipo: EnvDTE.VirtualPoint
A VirtualPoint objeto.

Comentários

Embora TextPoint objetos indicam o local do texto selecionado na Editor janela, eles não marcar a localização no buffer. Espaço virtual — a área além do fim da linha — também será rastreado apenas na Editor janela. Conseqüentemente, quando você usa um EditPoint no buffer de texto para modificar o texto, o que acontece com o texto selecionado não está definido. Por exemplo, um comando pode iniciar com o texto selecionado, obter pontos de edição e em seguida, altere o buffer. Para garantir que o texto selecionado estiver em um determinado local, você deve colocar explicitamente o texto selecionado no local no final do seu comando.

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

Segurança do .NET Framework

Consulte também

Referência

TextSelection Interface

Namespace EnvDTE