private void Log(string text, Style style) { //some stuffs for best performance fctb.BeginUpdate(); fctb.Selection.BeginUpdate(); //remember user selection var userSelection = fctb.Selection.Clone(); //add text with predefined style fctb.AppendText(text, style); //restore user selection if (!userSelection.IsEmpty || userSelection.Start.iLine < fctb.LinesCount - 2) { fctb.Selection.Start = userSelection.Start; fctb.Selection.End = userSelection.End; } else fctb.GoEnd();//scroll to end of the text // fctb.Selection.EndUpdate(); fctb.EndUpdate(); }
public void InitStyleSchema(Language lang) { switch (lang) { case Language.CSharp: StringStyle = BrownStyle; CommentStyle = GreenStyle; NumberStyle = MagentaStyle; AttributeStyle = GreenStyle; ClassNameStyle = BoldStyle; KeywordStyle = BlueStyle; CommentTagStyle = GrayStyle; break; case Language.VB: StringStyle = BrownStyle; CommentStyle = GreenStyle; NumberStyle = MagentaStyle; ClassNameStyle = BoldStyle; KeywordStyle = BlueStyle; break; case Language.HTML: CommentStyle = GreenStyle; TagBracketStyle = BlueStyle; TagNameStyle = MaroonStyle; AttributeStyle = RedStyle; AttributeValueStyle = BlueStyle; HtmlEntityStyle = RedStyle; break; case Language.JS: StringStyle = BrownStyle; CommentStyle = GreenStyle; NumberStyle = MagentaStyle; KeywordStyle = BlueStyle; break; case Language.PHP: StringStyle = RedStyle; CommentStyle = GreenStyle; NumberStyle = RedStyle; VariableStyle = MaroonStyle; KeywordStyle = MagentaStyle; KeywordStyle2 = BlueStyle; KeywordStyle3 = GrayStyle; break; case Language.SQL: StringStyle = RedStyle; CommentStyle = GreenStyle; NumberStyle = MagentaStyle; KeywordStyle = BlueBoldStyle; StatementsStyle = BlueBoldStyle; FunctionsStyle = MaroonStyle; VariableStyle = MaroonStyle; TypesStyle = BrownStyle; break; } }
public StyleVisualMarker(Rectangle rectangle, Style style) : base(rectangle) { this.Style = style; }
public VisualMarkerEventArgs(Style style, StyleVisualMarker marker, MouseEventArgs args) : base(args.Button, args.Clicks, args.X, args.Y, args.Delta) { this.Style = style; this.Marker = marker; }
private void miChangeColors_Click(object sender, EventArgs e) { var styles = new Style[] { fctb.SyntaxHighlighter.BlueBoldStyle, fctb.SyntaxHighlighter.BlueStyle, fctb.SyntaxHighlighter.BoldStyle, fctb.SyntaxHighlighter.BrownStyle, fctb.SyntaxHighlighter.GrayStyle, fctb.SyntaxHighlighter.GreenStyle, fctb.SyntaxHighlighter.MagentaStyle, fctb.SyntaxHighlighter.MaroonStyle, fctb.SyntaxHighlighter.RedStyle }; fctb.SyntaxHighlighter.AttributeStyle = styles[rnd.Next(styles.Length)]; fctb.SyntaxHighlighter.ClassNameStyle = styles[rnd.Next(styles.Length)]; fctb.SyntaxHighlighter.CommentStyle = styles[rnd.Next(styles.Length)]; fctb.SyntaxHighlighter.CommentTagStyle = styles[rnd.Next(styles.Length)]; fctb.SyntaxHighlighter.KeywordStyle = styles[rnd.Next(styles.Length)]; fctb.SyntaxHighlighter.NumberStyle = styles[rnd.Next(styles.Length)]; fctb.SyntaxHighlighter.StringStyle = styles[rnd.Next(styles.Length)]; fctb.OnSyntaxHighlight(new TextChangedEventArgs(fctb.Range)); }