다음을 통해 공유


TextSelection.AnchorPoint 속성

업데이트: 2007년 11월

선택 영역의 원점을 가져옵니다.

네임스페이스:  EnvDTE
어셈블리:  EnvDTE(EnvDTE.dll)

구문

ReadOnly Property AnchorPoint As VirtualPoint

Dim instance As TextSelection
Dim value As VirtualPoint

value = instance.AnchorPoint
VirtualPoint AnchorPoint { get; }
property VirtualPoint^ AnchorPoint {
    VirtualPoint^ get ();
}
function get AnchorPoint () : VirtualPoint

속성 값

형식: EnvDTE.VirtualPoint

VirtualPoint 개체입니다.

설명

TextPoint 개체는 편집기 창에서 선택한 텍스트의 위치를 나타내지만 버퍼 내의 위치는 표시하지 않습니다. 또한 줄의 끝을 넘는 가상 공간은 편집기 창에서만 추적됩니다. 따라서 텍스트 버퍼에서 EditPoint 개체를 사용하여 텍스트를 수정하는 경우 선택한 텍스트가 어떻게 처리되는지는 정의되지 않습니다. 선택한 텍스트로 시작하여 편집 지점을 가져온 다음 버퍼를 변경하는 명령을 예로 들 수 있습니다. 선택한 텍스트가 특정 위치에 있도록 하려면 명령의 끝에서 이 텍스트를 명시적으로 특정 위치에 지정해야 합니다.

예제

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

권한

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

TextSelection 인터페이스

TextSelection 멤버

EnvDTE 네임스페이스