Compartir a través de


EditPoint2.LineLength (Propiedad)

Obtiene el número de caracteres de una línea que contiene el objeto EditPoint, excluido el carácter de nueva línea.

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

Sintaxis

'Declaración
ReadOnly Property LineLength As Integer
int LineLength { get; }
property int LineLength {
    int get ();
}
abstract LineLength : int with get
function get LineLength () : int

Valor de propiedad

Tipo: Int32
Número de caracteres de una línea que contiene el objeto EditPoint, excluido el carácter de nueva línea.

Comentarios

La numeración de caracteres empieza por uno.

Ejemplos

Sub LineLengthExample(ByVal dte As DTE2)

    ' Create a new text file.
    dte.ItemOperations.NewFile()

    ' Create an EditPoint at the start of the new document.
    Dim doc As TextDocument = _
        CType(dte.ActiveDocument.Object("TextDocument"), TextDocument)
    Dim point As EditPoint = doc.StartPoint.CreateEditPoint
    Dim i As Integer

    ' Insert 10 lines of text.
    For i = 1 To 10
        point.Insert("This is a test." & vbCrLf)
    Next

    point.StartOfDocument()

    ' Display EditPoint properties.
    MsgBox( _
        "AbsoluteCharOffset: " & point.AbsoluteCharOffset & vbCrLf & _
        "LineCharOffset: " & point.LineCharOffset & vbCrLf & _
        "DisplayColumn: " & point.DisplayColumn & vbCrLf & _
        "AtEndOfDocument: " & point.AtEndOfDocument & vbCrLf & _
        "AtEndOfLine: " & point.AtEndOfLine & vbCrLf & _
        "AtStartOfDocument: " & point.AtStartOfDocument & vbCrLf & _
        "AtStartOfLine: " & point.AtStartOfLine & vbCrLf & _
        "LineLength: " & point.LineLength)

End Sub
public void LineLengthExample(DTE2 dte)
{
    // Create a new text file.
    dte.ItemOperations.NewFile(@"General\Text File", "", 
        Constants.vsViewKindPrimary);

    // Create an EditPoint at the start of the new document.
    TextDocument doc = 
        (TextDocument)dte.ActiveDocument.Object("TextDocument");
    EditPoint point = doc.StartPoint.CreateEditPoint();

    // Insert 10 lines of text.
    for (int i = 1; i <= 10; ++i)
        point.Insert("This is a test.\n");

    point.StartOfDocument();

    // Display EditPoint properties.
    MessageBox.Show(
        "AbsoluteCharOffset: " + point.AbsoluteCharOffset + "\n" +
        "LineCharOffset: " + point.LineCharOffset + "\n" + 
        "AtEndOfDocument: " + point.AtEndOfDocument + "\n" +
        "AtEndOfLine: " + point.AtEndOfLine + "\n" +
        "AtStartOfDocument: " + point.AtStartOfDocument + "\n" +
        "AtStartOfLine: " + point.AtStartOfLine + "\n" +
        "LineLength: " + point.LineLength);
}

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