TextSelection.AnchorPoint, propriété

Obtient le point d'origine de la sélection.

Espace de noms :  EnvDTE
Assembly :  EnvDTE (dans EnvDTE.dll)

Syntaxe

'Déclaration
ReadOnly Property AnchorPoint As VirtualPoint
VirtualPoint AnchorPoint { get; }
property VirtualPoint^ AnchorPoint {
    VirtualPoint^ get ();
}
abstract AnchorPoint : VirtualPoint with get
function get AnchorPoint () : VirtualPoint

Valeur de propriété

Type : EnvDTE.VirtualPoint
Objet VirtualPoint.

Notes

Bien que les objets TextPoint indiquent l'emplacement de la sélection de texte dans la fenêtre Éditeur, ils ne marque pas l'emplacement dans la mémoire tampon. L'espace virtuel (zone au-delà de la fin de la ligne) n'est donc repérable que dans la fenêtre Éditeur. Par conséquent, lorsque vous utilisez EditPoint dans la mémoire tampon de texte pour modifier le texte, ce qui arrive à la sélection de texte n'est pas défini. Par exemple une commande peut commencer par la sélection de texte, obtient des points d'édition, puis modifie la mémoire tampon. Pour garantir la sélection de texte est dans un emplacement, vous devez explicitement placer la sélection de texte dans cet emplacement à la fin de la commande.

Exemples

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

Sécurité .NET Framework

Voir aussi

Référence

TextSelection Interface

EnvDTE, espace de noms