internal static void DrawKnownColors(RichTextBox ctrl) { int currentCarret = ctrl.SelectionStart; AntiFlicker.BeginUpdate(ctrl.Handle); try { ctrl.SelectAll(); ctrl.SelectionColor = Color.Black; ctrl.DeselectAll(); DrawKnownColors(ctrl, Color.Gray, true, "inner", "left", "right", "join", "and", "or", "is null", "in", "exists", "not", "null"); DrawKnownColors(ctrl, Color.Blue, true, "select", "top", "distinct", "from", "where", "order by", "group by", "having", "asc", "desc", "case", "when", "else", "end", "then"); DrawKnownColors(ctrl, Color.FromArgb(255, 64, 255), true, "avg", "sum", "min", "count", "max", "coalesce"); DrawKnownColors(ctrl, Color.Brown, false, "'.*?'"); } finally { ctrl.Select(currentCarret, 0); AntiFlicker.EndUpdate(ctrl.Handle); ctrl.Invalidate(); } }
internal static void DrawKnownColors(RichTextBox ctrl) { int currentCarret = ctrl.SelectionStart; AntiFlicker.BeginUpdate(ctrl.Handle); try { ctrl.SelectAll(); ctrl.SelectionColor = Color.Black; ctrl.DeselectAll(); DrawKnownColors(ctrl, Color.Blue, true, "new", "string", "int", "short", "long", "bool", "var"); DrawKnownColors(ctrl, Color.Teal, true, "SelectQuery", "UpdateQuery", "WherePhrase", "WhereTerm", "WhereClause", "Int16", "Int32", "Int64", "Guid", "FromTerm", "CaseClause", "SqlExpression", "CaseTerm", "SelectColumn", "GroupByTerm", "slQueryParameters"); DrawKnownColors(ctrl, Color.Green, true, "CompareOperator", "WhereClauseRelationship", "JoinType", "OrderByDirection", "SqlAggregationFunction"); DrawKnownColors(ctrl, Color.DarkRed, DrawColorType.Strings); DrawKnownColors(ctrl, Color.Brown, DrawColorType.Chars); DrawComments(ctrl, Color.DarkGreen); } finally { ctrl.Select(currentCarret, 0); AntiFlicker.EndUpdate(ctrl.Handle); ctrl.Invalidate(); } }