Propriedade TextSelection.AnchorPoint
Obtém o ponto de origem de seleção.
Namespace: EnvDTE
Assembly: EnvDTE (em EnvDTE.dll)
Sintaxe
'Declaração
ReadOnly Property AnchorPoint As VirtualPoint
VirtualPoint AnchorPoint { get; }
property VirtualPoint^ AnchorPoint {
VirtualPoint^ get ();
}
abstract AnchorPoint : VirtualPoint with get
function get AnchorPoint () : VirtualPoint
Valor de propriedade
Tipo: EnvDTE.VirtualPoint
Um objeto VirtualPoint.
Comentários
Embora os objetos de TextPoint indicarem o local de seleção de texto na janela de Editor , não marcam o local no buffer. O espaço virtual — a área além do final da linha — também é controlado somente na janela de Editor . Portanto, quando você usa EditPoint no buffer de texto para alterar o texto, o que acontece a seleção de texto não está definido. Por exemplo um comando pode começar com seleção de texto, obtém pontos de edição, e altera ao buffer. Para garantir a seleção de texto está em algum local, você deve explicitamente colocar a seleção de texto naquele local no final do 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
- Confiança total para o chamador imediato. O membro não pode ser usado por código parcialmente confiável. Para obter mais informações, consulte Usando bibliotecas de código parcialmente confiável.