How does custom syntax highlighting in Scintilla work (and why doesn't mine)?
So anyways, I'm trying to implement custom syntax highlighting into a Scintilla control in Visual C#.NET.
I've been told do this through an XML file. I have named it "ScintillaNET.xml" and placed it in the debug bin for my project.
In the Form_Load, I set its language to batch (which is correct), and in the properties I specify the location of the file.
The code I have in the XML file is:
<?xml version="1.0" encoding="utf-8"?>
<ScintillaNET>
<!-- Set up the language, style, and lexer for batch -->
<Language Name="batch">
<!-- Lexer -->
<Lexer StreamCommentPrefix="{ " StreamCommentSuffix=" }">
<Keywords List="0">var</Keywords>
</Lexer>
<!-- Style -->
<Styles>
<Sytle Name="CHARACTER" ForeColor="Black" BackColor="Red"/>
</Styles>
<!-- Other Settings -->
<Indentation TabWidth="2" UseTabs="false"/>
</Language>
</ScintillaNET>
Unfortunately, that doesn't seem to work... When I run my program, nothing happens in Scintilla.
My main开发者_StackOverflow中文版 goal for the custom syntax highlighting is nothing complicated.
I just want to be able to: Choose the words to be highlighted. Choose the color to have them highlighted/colored in.
How do I do this? What's wrong with my code?
(and if anyone has a quick tutorial on how to do it, that would be appreciated)
I've tested your xml file in my machine. A windows form app with ScintillaNet Control and with your xml is working fine.
Make sure you do following:
- Your system "path" includes the directory where SciLexer.dll is located
- In ConfigrationManager property of ScintillaNet Control. Set the CustomLocation property = ScintillaNET.xml
- In ConfigrationManager property of ScintillaNet Control. Language property = batch.
references:
(Installation) http://scintillanet.codeplex.com/wikipage?title=Installation&referringTitle=Documentation
(How do I use my own configuration files?) http://scintillanet.codeplex.com/wikipage?title=HowToCustomConfig&referringTitle=Documentation
精彩评论