EditPoint.AbsoluteCharOffset Eigenschaft

Definition

Ruft das 1-basierte Zeichenoffset des EditPoint-Objekts ab.Gets the one-based character offset of the EditPoint object.

public:
 property int AbsoluteCharOffset { int get(); };
public:
 property int AbsoluteCharOffset { int get(); };
[System.Runtime.InteropServices.DispId(13)]
[get: System.Runtime.InteropServices.DispId(13)]
public int AbsoluteCharOffset { get; }
[<System.Runtime.InteropServices.DispId(13)>]
[<get: System.Runtime.InteropServices.DispId(13)>]
member this.AbsoluteCharOffset : int
Public ReadOnly Property AbsoluteCharOffset As Integer

Eigenschaftswert

Int32

Das 1-basierte Zeichenoffset vom Anfang des Dokuments bis zum EditPoint-Objekt.The one-based character offset from the beginning of the document to the EditPoint object.

Implementiert

Attribute

Beispiele

Sub AbsoluteCharOffsetExample(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  

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

End Sub  
public void AbsoluteCharOffsetExample(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");  

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

Hinweise

AbsoluteCharOffset Gibt die Anzahl von Zeichen von der obersten Position des Dokuments bis zum-Objekt zurück.AbsoluteCharOffset returns the number of characters from the top of the document to the object. Die- LineCharOffset Eigenschaft bestimmt die Anzahl der Zeichen nur am Anfang der Zeile, die das-Objekt enthält.The LineCharOffset property determines the number of characters only from the beginning of the line containing the object. Neue Zeilenzeichen zählen als ein Zeichen.New line characters count as one character.

Die Zeichen Nummerierung beginnt bei 1.Character numbering begins at one.

Gilt für: