EditPoint.EqualTo 메서드 (TextPoint)

지정된 지점 개체의 AbsoluteCharOffset 값이 호출하는 EditPoint 개체의 속성 값과 같은지 여부를 나타내는 값을 반환합니다.

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

구문

‘선언
Function EqualTo ( _
    Point As TextPoint _
) As Boolean
bool EqualTo(
    TextPoint Point
)
bool EqualTo(
    [InAttribute] TextPoint^ Point
)
abstract EqualTo : 
        Point:TextPoint -> bool 
function EqualTo(
    Point : TextPoint
) : boolean

매개 변수

반환 값

형식: System.Boolean
Point의 AbsoluteCharOffset 속성 값이 호출하는 EditPoint 지점 개체의 속성 값과 같으면 true이고 그렇지 않으면 false입니다.

구현

TextPoint.EqualTo(TextPoint)

설명

EqualTo는 호출하는 지점 개체와 동일한 문서에 Point가 없는 경우 ArgumentException 예외를 throw합니다. VirtualPoint를 사용하면 EqualTo는 인수가 VirtualPoint인 경우 가상 위치를 비교하고 그렇지 않은 경우에는 "실제" 위치를 비교합니다.

예제

Sub EqualToExample(ByVal dte As DTE2)

    ' Create a new text file.
    dte.ItemOperations.NewFile()
    Dim txtDoc As TextDocument = _
        CType(dte.ActiveDocument.Object(), TextDocument)

    ' Create an edit point at the empty text document's StartPoint 
    ' and EndPoint; CompareEditPoints displays "point1 and point2
    ' occupy the same location."
    Dim point1 As EditPoint = txtDoc.StartPoint.CreateEditPoint()
    Dim point2 As EditPoint = txtDoc.EndPoint.CreateEditPoint()
    CompareEditPoints(point1, point2)

    ' Insert ten lines of text.
    Dim i As Integer
    For i = 1 To 10
        point1.Insert("Line " & i.ToString() & vbCrLf)
    Next

    ' Create an edit point at the text document's StartPoint and 
    ' EndPoint; CompareEditPoints displays "point1 comes before
    ' point2."
    point1 = txtDoc.StartPoint.CreateEditPoint()
    point2 = txtDoc.EndPoint.CreateEditPoint()
    CompareEditPoints(point1, point2)

End Sub

Sub CompareEditPoints(ByVal point1 As EditPoint, _
    ByVal point2 As EditPoint)

    If point1.LessThan(point2) Then
        MsgBox("point1 comes before point2.")
    ElseIf point1.GreaterThan(point2) Then
        MsgBox("point2 comes before point1.")
    ElseIf (point1.EqualTo(point2)) Then
        MsgBox("point1 and point2 occupy the same location.")
    End If

End Sub
public void EqualToExample(DTE2 dte)
{

    // Create a new text file.
    dte.ItemOperations.NewFile(@"General\Text File", "", 
        Constants.vsViewKindPrimary);
    TextDocument txtDoc = 
        (TextDocument)dte.ActiveDocument.Object("TextDocument");

    // Create an edit point at the empty text document's StartPoint 
    // and EndPoint; CompareEditPoints displays "point1 and point2
    // occupy the same location."
    EditPoint point1 = txtDoc.StartPoint.CreateEditPoint();
    EditPoint point2 = txtDoc.EndPoint.CreateEditPoint();
    CompareEditPoints(point1, point2);

    // Insert ten lines of text.
    for (int i = 1; i <= 10; i++)
        point1.Insert("Line " + i.ToString() + "\r\n");

    // Create an edit point at the text document's StartPoint and 
    // EndPoint; CompareEditPoints displays "point1 comes before 
    // point2."
    point1 = txtDoc.StartPoint.CreateEditPoint();
    point2 = txtDoc.EndPoint.CreateEditPoint();
    CompareEditPoints(point1, point2);
}

public void CompareEditPoints(EditPoint point1, EditPoint point2)
{
    if (point1.LessThan(point2))
        MessageBox.Show("point1 comes before point2.");
    else if (point1.GreaterThan(point2))
        MessageBox.Show("point2 comes before point1.");
    else if (point1.EqualTo(point2))
        MessageBox.Show("point1 and point2 occupy the same location.");
}

.NET Framework 보안

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

참고 항목

참조

EditPoint 인터페이스

EqualTo 오버로드

EnvDTE 네임스페이스

기타 리소스

방법: 자동화 개체 모델 코드의 예제 컴파일 및 실행