How to tell a Style tag to not change ForeColor?

SyntaxEditor for Windows Forms Forum

Posted 6 years ago by Cody Thompson - Space Systems Engineer, a.i. solutions
Version: 13.1.0310
Avatar

I am changing the BackColor attribute for my syntax editor in the "BracketHighlightingStyle" style, and it works perfectly. My problem is that the ForeColor attribute defaults to "Black", and changes the ForeColor when I don't want it to. What do I have to set the ForeColor attribute to in order to get it to not change the ForeColor of the text? Thanks.

Comments (5)

Posted 6 years ago by Tobias Lingemann - Software Devolpment Engineer, Vector Informatik GmbH
Avatar

Color.Empty should do the trick.

HighlightingStyle style = new HighlightingStyle(key, name, Color.Empty, Color.Blue);
language.HighlightingStyles.Add(style);


Best regards, Tobias Lingemann.

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

Hi Cody,

I believe you can also pass "Default" in the XML definition to let it keep the default.


Actipro Software Support

Posted 6 years ago by Cody Thompson - Space Systems Engineer, a.i. solutions
Avatar

Yeah, I did it from the XML and "Default" worked perfectly. Thanks guys!

Posted 5 years ago by NorthGates - NorthGates Systems
Avatar

Just encountering same effect, can you elaborate (in code) where and how you do it? I tried a few things without success.

I am using the addon.xmlsyntaxlanguage.

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

To do it programmatically you would do:

editor.Document.Language.HighlightingStyles.Add(new HighlightingStyle("BracketHighlightingStyle", "Bracket Highlighted Text", Color.Empty, Color.Blue));

That being said, I don't think the lexer for the XML language is configured to support bracket highlighting at this time.  So it wouldn't make a difference in this case.


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.