Ejemplo n.º 1
0
 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();
 }
Ejemplo n.º 2
0
 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;
     }
 }
Ejemplo n.º 3
0
 public StyleVisualMarker(Rectangle rectangle, Style style)
     : base(rectangle)
 {
     this.Style = style;
 }
Ejemplo n.º 4
0
 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;
 }
Ejemplo n.º 5
0
        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));
        }