Exemplo n.º 1
0
        void ConfigureEditor(ScintillaControl sci, string code)
        {
            editor.SetMarginWidthN(1, 0);

            editor.ConfigurationLanguage = sci.ConfigurationLanguage;

            editor.Text = "  ";
            columnWidth = editor.PointXFromPosition(1) - editor.PointXFromPosition(0);
            rowHeight   = editor.TextHeight(0);

            editor.TabWidth = sci.TabWidth;
            editor.Text     = code;

            editor.SetProperty("lexer.cpp.track.preprocessor", "0");

            Language language = GetLanguage(editor.ConfigurationLanguage);

            if (language == null)
            {
                return;
            }

            UseStyle defaultStyle = null;

            foreach (var useStyle in language.usestyles)
            {
                if (useStyle.name == "default")
                {
                    defaultStyle = useStyle;
                    break;
                }
            }

            if (defaultStyle == null)
            {
                return;
            }

            codeTip.BackColor = DataConverter.BGRToColor(defaultStyle.BackgroundColor);
        }