This is a migrated thread and some comments may be shown as answers.

[Solved] Remove Highlighted Text

1 Answer 175 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Marcel
Top achievements
Rank 1
Marcel asked on 25 Aug 2011, 03:45 PM
Hi,

I have written a function which takes a bookmark, highlights that bookmark then navigates to it. The only problem is, using previousbookmark doesn't remove the old highlighted text. So i end up with all the bookmarks highlighted. Any ideas as to what i'm missing.

void NavigateAndHighLightBookMark(BookmarkRangeStart bookmark)

{
    if (previousbookmark != null)
   {
    this.radRichTextBox1.Document.Selection.Clear();
    this.radRichTextBox1.Document.Selection.SelectAnnotationRange(previousbookmark);
    this.radRichTextBox1.ChangeTextHighlightColor(Colors.Transparent);
   }
    

   this.radRichTextBox1.Document.Selection.SelectAnnotationRange(bookmark);
   this.radRichTextBox1.ChangeTextHighlightColor(Colors.LightGray);
   this.radRichTextBox1.Document.GoToBookmark(bookmark);
   previousbookmark = bookmark;
}

Thanks.

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Marcel
Top achievements
Rank 1
answered on 26 Aug 2011, 11:04 AM
Awwww, silly mistake, I forgot to clear the Selection before highlighting the new bookmark.

Sorted.
Tags
RichTextBox
Asked by
Marcel
Top achievements
Rank 1
Answers by
Marcel
Top achievements
Rank 1
Share this question
or