Change background color for region of text

SyntaxEditor for WPF Forum

Posted 7 years ago by Kamal Paul
Version: 12.2.0571
Avatar

Hi,

For the WPF syntax editor I have section of text that I need to set the background color for. I do not wish to set the background color of the entire editor only certain lines. Is there a way that we can do this?

Thanks,

Kamal

Comments (4)

Answer - Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Kamal,

Yes you can use classification tags to color the background of certain ranges of text.  Several of the adornments QuickStarts show this kind of thing.


Actipro Software Support

Posted 7 years ago by Kamal Paul
Avatar

I was able to accomplish this using classification tags and lexical state pattern. However currently the highlighting stops at the end of each string whereas I would like the entire line to be highlighted. For example:

//This is the Start marker
//In code editing, variables are initialized with random values.
//True variable values will be assigned when the code is executed.
var tmp1 = 0.12789542;
var tmp2 = 0.29653338;
var tmp3 = 0.74635917;                                                   

//This is the end marker

I would like the entire lines (including the blank one) between the start/end string markers to be highlighted in gray. Could you possibly provide a example of how I could define a pattern group to accomplish this?

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Kamal,

I'm sorry but that isn't currently supported.  We'll add a TODO list item for if the line terminator is included in the tagged region, to color through the visible line end.

In the meantime, you'd have to use the lower level adornment features to do it.  Some QuickStarts show adornment examples.


Actipro Software Support

Answer - Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Kamal,

We wanted to let you know that this feature was added in one of the last several builds.  You can set the IHighlightingStyle.BackgroundSpansVirtualSpace property to true to make the style render all the way to the right edge of the view.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.