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

Custom UI Layer - highlight bookmarks

3 Answers 59 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Charles
Top achievements
Rank 1
Charles asked on 21 Feb 2012, 06:14 PM
Hi

I'm slowly battling with this, so thought I'd ask in case anyone can shed any light on it more quickly than my efforts!

I'm trying to use a Custom UI Layer to implement highlighting of bookmarks.  Using the demos, I can see how to create rectangles for highlighting, but I'm struggling with how to highlight the right areas if the bookmarked text flows over more than one line.

Presumably, I need to be able to find if it runs over more than one line, and get the dimensions from the start to the end and create a rectangle for that.

Then get the dimensions from the start of the next line until the first of 1. the end of the bookmark or 2. the end of the line.

Repeat until the end is found (or the UILayerUpdateContext runs out of visible boxes).

Thanks for any help!  The documentation is a bit thin in this area...

Charlie

3 Answers, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 21 Feb 2012, 06:42 PM
Hi Charlie,

You don't need to implement a custom UI layer for highlighting the bookmarks, as there is such a layer among the default ones.
In order to show the highlight of bookmarks, you just need to set the ShowBookmarks property of RadDocument to true.
I hope this helps.

All the best,
Iva Toteva
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Charles
Top achievements
Rank 1
answered on 21 Feb 2012, 07:24 PM
Hi Iva Sorry, I should have been clearer. I already have ShowBookmarks enabled. My requirement is to highlight the bookmark range in a colour that determined by some business logic on a per bookmark basis. This highlighting should not be persisted or printed - just on screen. I think the Custom Layer is the most suitable here. I'm fine with all of this, except for obtaining the correct rectangle coordinates for ranges that span multiple lines.
0
Martin Ivanov
Telerik team
answered on 24 Feb 2012, 10:12 AM
Hi Charles,

We have implementation to a problem similar to yours: highlighting custom tooltip fields on multiple lines. In the attached file you can check the UpdateUIViewPortOverride() method and modify it according to your logic.
I hope this will help you.

Don't hesitate to contact us if you have other questions.

Regards,
Martin
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
RichTextBox
Asked by
Charles
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Charles
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or