示例#1
0
        private void InitSyntaxColoring()
        {
            // Configure the default style
            TextArea.StyleResetDefault();
            TextArea.Styles[Style.Default].Font         = "Consolas";
            TextArea.Styles[Style.Default].Size         = 10;
            TextArea.Styles[Style.Default].BackColor    = Color.GhostWhite; // IntToColor(0x212121);
            TextArea.Styles[Style.Default].ForeColor    = Color.Black;      // IntToColor(0x0);
            TextArea.Styles[Style.BraceLight].BackColor = TextArea.Styles[Style.Default].BackColor;
            TextArea.Styles[Style.BraceLight].ForeColor = Color.BlueViolet;
            TextArea.Styles[Style.BraceBad].ForeColor   = Color.Red;
            TextArea.StyleClearAll();

            // Configure the CPP (C#) lexer styles
            TextArea.Styles[Style.Cpp.Identifier].ForeColor             = Color.Purple;                                      //IntToColor(0xD0DAE2);
            TextArea.Styles[Style.Cpp.Comment].ForeColor                = Color.Green;                                       //IntToColor(0xBD758B);
            TextArea.Styles[Style.Cpp.CommentLine].ForeColor            = TextArea.Styles[Style.Cpp.Comment].ForeColor;      //IntToColor(0x40BF57);
            TextArea.Styles[Style.Cpp.CommentDoc].ForeColor             = TextArea.Styles[Style.Cpp.Comment].ForeColor;      //IntToColor(0x2FAE35);
            TextArea.Styles[Style.Cpp.Number].ForeColor                 = Color.DarkOrange;                                  //IntToColor(0xFFFF00);
            TextArea.Styles[Style.Cpp.String].ForeColor                 = Color.Fuchsia;                                     //IntToColor(0xFFFF00);
            TextArea.Styles[Style.Cpp.Character].ForeColor              = Color.DeepPink;                                    //IntToColor(0xE95454);
            TextArea.Styles[Style.Cpp.Preprocessor].ForeColor           = Color.Blue;                                        //IntToColor(0x8AAFEE);
            TextArea.Styles[Style.Cpp.Operator].ForeColor               = Color.Black;                                       //IntToColor(0xE0E0E0);
            TextArea.Styles[Style.Cpp.Regex].ForeColor                  = Color.Black;                                       //IntToColor(0xff00ff);
            TextArea.Styles[Style.Cpp.CommentLineDoc].ForeColor         = TextArea.Styles[Style.Cpp.CommentLine].ForeColor;  //IntToColor(0x77A7DB);
            TextArea.Styles[Style.Cpp.Word].ForeColor                   = TextArea.Styles[Style.Cpp.Preprocessor].ForeColor; // IntToColor(0x48A8EE);
            TextArea.Styles[Style.Cpp.Word2].ForeColor                  = TextArea.Styles[Style.Cpp.Preprocessor].ForeColor; //IntToColor(0xF98906);
            TextArea.Styles[Style.Cpp.CommentDocKeyword].ForeColor      = Color.Black;                                       //IntToColor(0xB3D991);
            TextArea.Styles[Style.Cpp.CommentDocKeywordError].ForeColor = Color.Black;                                       //IntToColor(0xFF0000);
            TextArea.Styles[Style.Cpp.GlobalClass].ForeColor            = Color.OrangeRed;                                   //IntToColor(0x48A8EE);

            TextArea.Lexer = Lexer.Cpp;

            TextArea.SetKeywords(0, "case do while else if for switch throw function var try catch while default break continue return include using");
            TextArea.SetKeywords(1, "bool int string variant double");
            string test = TextArea.DescribeKeywordSets();
        }