protected override void OnTextChanged(EventArgs e) { if (!IsRedrawDisabled) { base.OnTextChanged(e); DisableRedraw(); int selectionStart = SelectionStart; int selectionLength = SelectionLength; Font regularFont = new Font(Font, FontStyle.Regular); Font boldFont = new Font(Font, FontStyle.Bold); Parser = new NuGenParser(Text); SelectAll(); SelectionIndent = 70; SelectionColor = Color.Black; SelectionFont = regularFont; foreach (NuGenComment comment in Parser.Comments) { SelectionStart = comment.StartPosition; if (comment.EndPosition == 0) { SelectionLength = selectionStart - comment.StartPosition; } else { SelectionLength = comment.Length; } SelectionColor = Color.Green; } if (!DesignMode) { foreach (NuGenWord word in Parser.Words) { if (OpCodeNames.Contains(word.WordBuilder.ToString()) && word.IsFirstWordInLine) { SelectionStart = word.StartPosition; SelectionLength = word.Length; SelectionFont = boldFont; } } } SelectionStart = selectionStart; SelectionLength = selectionLength; EnableRedraw(); Invalidate(); } }