Compartir a través de


EditPoint2.EqualTo (Método)

Devuelve un valor que indica si el valor de AbsoluteCharOffset del punto determinado es igual que el del objeto EditPoint llamador.

Espacio de nombres:  EnvDTE80
Ensamblado:  EnvDTE80 (en EnvDTE80.dll)

Sintaxis

'Declaración
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

Parámetros

  • Point
    Tipo: TextPoint

    Obligatorio. Objeto TextPoint que se va a comparar con el objeto EditPoint llamador.

Valor devuelto

Tipo: Boolean
Valor booleano que es true si Point tiene el mismo valor de la propiedad AbsoluteCharOffset que el objeto EditPoint llamador; de lo contrario, false.

Comentarios

EqualTo producirá una excepción ArgumentException si Point no está en el mismo documento que el objeto de punto de llamada. Con VirtualPoint, EqualTo compara las ubicaciones virtuales si el argumento es VirtualPoint; de lo contrario, compara las ubicaciones físicas.

Ejemplos

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.");
}

Seguridad de .NET Framework

Vea también

Referencia

EditPoint2 Interfaz

EnvDTE80 (Espacio de nombres)

Otros recursos

Cómo: Compilar y ejecutar los ejemplos de código del modelo de objetos de automatización