使用闪烁网自定义突出显示

本文关键字:显示 自定义 闪烁 | 更新日期: 2023-09-27 18:35:50

在我的Winforms应用程序中,我会创建一个自定义语法突出显示,所以我做了这个xml:

<ScintillaNET>
  <Language Name="default">
    <Styles>
      <Style Name="Default" FontName="Consolas"/>
    </Styles>
  </Language>
  <Language Name="customSql">
    <Lexer LineCommentPrefix="--" StreamCommentPrefix="/* " StreamCommentSuffix=" /*" LexerName="customSql" >
      <Keywords List="0">
        Data Source Initial Catalog User Id Password Database Server Trusted_Connection
        Integrated Security Network Library User Instance AttachDbFilename Failover Partner
        Asynchronous Processing Uid Pwd Provider SSPI
      </Keywords>
    </Lexer>
    <Styles>
      <Sytle Name="CHARACTER" ForeColor="Black"/>
      <Sytle Name="NUMBER" ForeColor="Red" />
    </Styles>
  </Language>
</ScintillaNET>

对我来说看起来不错。在我的应用程序中,我将语言和其他属性设置为:

myC.ConfigurationManager.Language = "customSql";
myC.ConfigurationManager.CustomLocation = Global.Path + @"Resources'ScintillaNET.xml";
myC.ConfigurationManager.Configure();

我不明白为什么这仍然不起作用。我也不例外,只是文本保持黑色。有什么提示吗?

使用闪烁网自定义突出显示

也许是因为您将前彩设置为黑色,但从未将背景色设置为黑色以外的其他颜色?