How to use custom drawing for the SyntaxEdit control?

SyntaxEdit supports Custom Drawing feature allowing customizing drawing of text fragments and graphic primitives. The following code demonstrates how to highlight known identifiers with different color:

private void syntaxEdit1_CustomDraw(object sender, CustomDrawEventArgs e)
  LexToken tok = (LexToken)(e.DrawInfo.Style - 1);
  if ((tok == LexToken.Identifier) && (e.DrawStage == DrawStage.Before) && ((DrawState.Selection & e.DrawState) == 0))
   &nbspif (knownIdentifiers.ContainsKey(e.DrawInfo.Text))
      e.Painter.TextColor = Color.Teal;


No Very

Captcha Image