need a simple way to highlight a literal string

SyntaxEditor for Windows Forms Forum

Posted 13 years ago by Steve Millar
Avatar
I have an app that uses the html response language template and I love the highlighting. I want to maintain all the existing highlighting but add a custom highlighting style and apply it to a regex match (actually just match on a literal string) in the document. Is there a c# code sample on your site that shows me how to do this?

I don't need all the advanced lexical state analysis. I just need to look for a string literal and highlight it with a specific foreground and background color without giving up the existing highlighting.

Comments (3)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
The easiest thing to do would be to modify your language to also look for your literal keyword and style it appropriately. I'd recommend this approach.

If that is not possible, you could always use span indicators to highlight the instances of the literals. But that will require you to look for them as the document text changes and add/remove the indicators as needed.


Actipro Software Support

Posted 13 years ago by Steve Millar
Avatar
The document I am highlighting will not be user editable so I only need to load the text one time. Is there a code sample of using span indicators that you could point me to?
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
In the MainForm.cs file, search on "new Breakpoint" and you'll see some code that adds some of our built-in indicators.

You can also create custom span indicators if you don't like ours. This support forum has a couple postings on that if you search for them.


Actipro Software Support

The latest build of this product (v2018.1 build 0341) was released 6 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.