开发者

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.

How does custom syntax highlighting in Scintilla work (and why doesn't mine)?

Make sure you do following:

  1. Your system "path" includes the directory where SciLexer.dll is located
  2. In ConfigrationManager property of ScintillaNet Control. Set the CustomLocation property = ScintillaNET.xml
  3. 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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜