Freigeben über


EditPoint2.PreviousBookmark-Methode

Verschiebt den Bearbeitungsposition an die Position des vorherigen Lesezeichens im Dokument.

Namespace:  EnvDTE80
Assembly:  EnvDTE80 (in EnvDTE80.dll)

Syntax

'Declaration
Function PreviousBookmark As Boolean
bool PreviousBookmark()
bool PreviousBookmark()
abstract PreviousBookmark : unit -> bool
function PreviousBookmark() : boolean

Rückgabewert

Typ: Boolean
true , wenn der Bearbeitungspunkt zu einem vorherigen Lesezeichen verschoben wird; andernfalls false.

Hinweise

Wenn keine weiteren Lesezeichen vorhanden sind, wird der Bearbeitungspunkt nicht verschoben.

PreviousBookmark verschiebt das EditPoint-Objekt an die Position des ersten Lesezeichens, das sich vor der Position des aktiven Endes von EditPoint befindet. EditPoint wird an der neuen Position reduziert.

Beispiele

Sub PreviousBookmarkExample(ByVal dte As DTE2)

    ' Create a new text document.
    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 ten lines of text.
    For i = 1 To 10
        point.Insert("This is a test." & vbCrLf)
    Next

    point.StartOfDocument()

    ' Set a bookmark on each of the first two lines.
    point.SetBookmark()
    point.LineDown(1)
    point.SetBookmark()

    ' Insert text at each bookmark and then clear each bookmark.
    point.PreviousBookmark()
    point.Insert("BOOKMARK 1: ")
    point.ClearBookmark()
    point.NextBookmark()
    point.Insert("BOOKMARK 2: ")
    point.ClearBookmark()

End Sub
public void PreviousBookmarkExample(DTE2 dte)
{
    // Create a new text document.
    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 ten lines of text.
    for (int i = 1; i <= 10; ++i)
        point.Insert("This is a test.\n");

    point.StartOfDocument();

    // Set a bookmark on each of the first two lines.
    point.SetBookmark();
    point.LineDown(1);
    point.SetBookmark();

    // Insert text at each bookmark and then clear each bookmark.
    point.PreviousBookmark();
    point.Insert("BOOKMARK 1: ");
    point.ClearBookmark();
    point.NextBookmark();
    point.Insert("BOOKMARK 2: ");
    point.ClearBookmark();
}

.NET Framework-Sicherheit

Siehe auch

Referenz

EditPoint2 Schnittstelle

EnvDTE80-Namespace

Weitere Ressourcen

Gewusst wie: Kompilieren und Ausführen der Codebeispiele für das Automatisierungsobjektmodell