Ejemplo n.º 1
0
        public SyntaxTextBox()
        {
            InitializeComponent();
            Style commandStyle = new Style();
            commandStyle.Foreground = Color.DarkRed;

            Style keywordStyle = new Style();
            keywordStyle.FontSize = 8;
            keywordStyle.Foreground = Color.DarkGreen;

            IndicatorStyles.Add('@', commandStyle);

            Keywords.Add("hello", keywordStyle);
            Keywords.Add("blubber", keywordStyle);
        }
Ejemplo n.º 2
0
        //returns word-offset
        private int HighlightAt(int index, Style style)
        {
            int offset;

            for (offset = 0; textChars[index + (offset+1)] == ' '; offset++)
            {

            }

            this.Select(index, index + offset);
            this.SelectionBackColor = style.Background;
            this.SelectionColor = style.Foreground;
            this.SelectionFont = new Font(style.Fontfamily, style.FontSize, style.Fontstyle);

            return offset;
        }