in my winforms application I would create a custom syntax highlight, so I made this 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>

Looks fine for me. In my application I set the language and further properties as:

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

I cannot figure why this still doesn't work. I have no exception, simply the text remain black. Any hints?

有帮助吗?

解决方案

Perhaps because you set the ForeColor to Black, but never set the BackColor to something other than black?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top