EditPoint.PreviousBookmark, méthode

Déplace le point d'édition vers l'emplacement du signet précédent dans le document.

Espace de noms :  EnvDTE
Assembly :  EnvDTE (dans EnvDTE.dll)

Syntaxe

'Déclaration
Function PreviousBookmark As Boolean
bool PreviousBookmark()
bool PreviousBookmark()
abstract PreviousBookmark : unit -> bool 
function PreviousBookmark() : boolean

Valeur de retour

Type : System.Boolean
Une valeur booléenne indiquant true si le point d'édition se place sur un signet précédent et false dans le cas contraire.

Notes

S'il n'y a pas d'autre signet, le point d'édition n'est pas déplacé.

PreviousBookmark déplace l'objet EditPoint vers l'emplacement du premier signet précédant l'extrémité active de l'objet EditPoint. L'objet EditPoint est réduit au nouvel emplacement.

Exemples

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();
}

Sécurité .NET Framework

Voir aussi

Référence

EditPoint Interface

EnvDTE, espace de noms

Autres ressources

Comment : compiler et exécuter les exemples de code du modèle objet Automation