$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
RichTextBox Control for Windows Forms
Edit rich text content with text formatting options, mail-merge, table, and floating objects, etc.
Home > WinForms UI Controls > User Manual > RichTextBox Bookmarks Element in C#

Document Bookmark of RichTextBox in C#.NET

KetticRichTextBox WinForms control allows the users to create bookmarks in the document for their application. The bookmarks can be added through C# code or via the user interface of the KetticRichTextBox. The users of the control are also able to use the hyperlinks to point to the annotations in the KetticDocument, as is provided the way of simple navigation in the document and enables table contents features.

Add Bookmarks to Document through UI

KetticRichTextBox control contains the AddBookmarksDialog of user interface for the users to add Bookmarks in the document.

Methods for Adding Bookmarks in Document of KetticRichTextBox

KetticRichTextBox .NET component encapsulate the bookmarks features in the BookmarkRangeStart and BookMarkRangeEnd document element. The following are the methods included in the KetticRichTextBox and KetticDocument for adding and removing Bookmarks in document.
  • this.editor.AddBookmark(), this method is used to insert a Bookmark with the bookmark name that is assigned. When the users want to mark a part of the document, the BookmarkRangeStart and BookmarkRangeEnd will be respectively added to the start and end of the contents selected.
  • this.editor.Document.GoToBookmark(), this method is used to navigate the caret to the bookmark that is assigned.
  • this.editor.Document.Selection.ChooseAnnotationRange(), this method is used to choose the annotation passed as parameter and it is useful because most methods of KetticRichTextBox and KetticDocument are operated on the selection.
  • this.editor.RemoveBookmark(), this method is used to delete the bookmark in the document.
  • this.editor.Document.GetAllBookmarks(), this methods is able to return an IEnumerable with the entire BookmarkRangeStarts.
  • this.editor.Document.EnumerateChildrenOfType(), this methods is able to return the complete Bookmarks in the document and is used on document rather than KetticDocument.

C# Add Bookmarks to Document in .NET Project

In a document created using C# code, bookmarks can also be added. The users can add the BookmarkRangeStart and BookMarkRangeEnd to the Inlines property of a Paragraph for they inherit from Inline. The following C# code shows how to add bookmarks to document in C#.NET project.

Dictionary<string, string> bookmarksToContent = new Dictionary<string, string>();
private void ReplaceContentOfBookmark(string bookmarkName)
{
BookmarkRangeStart bookmark = this.ketticRichTextBox1.Document.GetBookmarkByName(bookmarkName);
this.ketticRichTextBox1.Document.Selection.SelectAnnotationRange(bookmark);
this.ketticRichTextBox1.Document.Delete(false);
this.ketticRichTextBox1.Insert(bookmarksToContent[bookmarkName]);
}
UI Controlsfor Windows Forms
.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls