Table of Contents

Property BookMarks

Namespace
Alternet.Editor.TextSource
Assembly
Alternet.Editor.v9.dll

BookMarks

Represents an object that implements IBookMarks interface holding collection of IBookMark objects each determining particular bookmark within the text source.

[Browsable(false)]
public virtual IBookMarks BookMarks { get; set; }

Property Value

IBookMarks

Examples

Here is how to use a BookMarks in the C# code:

using System;

using Alternet.Editor;
using Alternet.Editor.TextSource;

public partial class Form1 : Form
{
    private TextSource textSource;
    private void Form1_Load(object sender, EventArgs e)
    {
        var syntaxEdit = new SyntaxEdit(this.components);
        textSource = new TextSource(this.components);
        textSource.LoadFile("myfile.txt");
        syntaxEdit.Source = this.textSource;
        syntaxEdit.Source.BookMarks.SetBookMark(new Point(6, 1), 0);
        syntaxEdit.Source.BookMarks.SetBookMark(new Point(9, 15), 7);

        Random rnd = new Random();
        syntaxEdit.Source.BookMarks.ToggleBookMark(rnd.Next(syntaxEdit.Lines.Count - 1), int.MaxValue);
    }
}

Here is how to use a BookMarks in the Visual Basic code:

Imports System
Imports Alternet.Editor
Imports Alternet.Editor.TextSource

Partial Public Class Form1
    Inherits Form

    Private textSource As TextSource

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        Dim syntaxEdit = New SyntaxEdit(Me.components)
        textSource = New TextSource(Me.components)
        textSource.LoadFile("myfile.txt")
        syntaxEdit.Source = Me.textSource
        syntaxEdit.Source.BookMarks.SetBookMark(New Point(6, 1), 0)
        syntaxEdit.Source.BookMarks.SetBookMark(New Point(9, 15), 7)
        Dim rnd As Random = New Random()
        syntaxEdit.Source.BookMarks.ToggleBookMark(rnd.Next(syntaxEdit.Lines.Count - 1), Integer.MaxValue)
    End Sub
End Class

Remarks

You can use bookmarks to mark lines in the code to quickly return to a specific location or jump back and forth between locations.

Use Shared property to specify that bookmarks need to work across multiple documents.