http://www.c-sharpcorner.com/Code/2002/Oct/ColorSyntaxEditor.asp
http://www.icsharpcode.net/OpenSource/SD/Default.aspx

解决方案 »

  1.   

    static Regex regexCSKeywords = new Regex(@"(?-i)(?<x>((?<=(^|\W))(#define|#elif|#else|#endif|#if|#undef|abstract|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|do|double|else|enum|explicit|extern|false|finally|fixed|float|for|foreach|get|goto|if|implicit|in|int|interface|internal|is|lock|long|namespace|new|null|object|operator|out|override|private|protected|public|readonly|ref|return|sealed|set|short|sizeof|static|string|struct|switch|sysint|this|throw|true|try|typeof|unchecked|union|unsafe|using|virtual|void|while)(?=(\Z|\W))))", RegexOptions.IgnoreCase );
        const string replaceCSKeywords = TAG_1 + "${x}" + TAG_1_END;