1

在我的 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();

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

4

1 回答 1

1

也许是因为您将 ForeColor 设置为 Black,但从未将 BackColor 设置为黑色以外的其他颜色?

于 2012-05-30T17:39:14.843 回答