示例#1
0
        /// <summary>
        /// Method will be called before the <see cref="IOptionPanel"/> is shown first.
        /// </summary>
        public override void InitializeControl()
        {
            string[] fontList = PopulateFontList();

            if (fontList.Length > 0)
            {
                cmbFont.Items.AddRange(fontList);
            }

            foreach (string fontStr in cmbFont.Items)
            {
                if (fontStr == Settings.Default.ScriptEditorFontName)
                {
                    cmbFont.SelectedItem = fontStr;
                    break;
                }
            }

            if (cmbFont.SelectedItem == null)
            {
                // The font 'Microsoft Sans Serif' should always be available!
                cmbFont.Items.Add(DEFAULT_FONT_NAME);
                cmbFont.SelectedItem = DEFAULT_FONT_NAME;
            }

            cmbFontSize.Text = Settings.Default.ScriptEditorFontSize.
                               ToString(CultureInfo.InvariantCulture);

            nudTabSize.Value = Settings.Default.ScriptEditorTabSize;
            chkInsertSpaceForTabs.Checked   = Settings.Default.ScriptEditorUseSpacesForTabs;
            chkWordWrap.Checked             = Settings.Default.ScriptEditorWordWrap;
            chkHighlightCurrentLine.Checked = Settings.Default.ScriptEditorHighlightCurrentLine;

            lstElements.Items.Add(CodeElement.Load("Bracket", "Bracket"));
            lstElements.Items.Add(CodeElement.Load("Comment", "Comment"));
            lstElements.Items.Add(CodeElement.Load("Default Text", "DefaultText"));
            lstElements.Items.Add(CodeElement.Load("Identifier", "Identifier"));
            lstElements.Items.Add(CodeElement.Load("Keyword", "Keyword"));
            lstElements.Items.Add(CodeElement.Load("Logbert Function", "LogbertFunction"));
            lstElements.Items.Add(CodeElement.Load("Lua Function", "LuaFunction"));
            lstElements.Items.Add(CodeElement.Load("Number", "Number"));
            lstElements.Items.Add(CodeElement.Load("Operator", "Operator"));
            lstElements.Items.Add(CodeElement.Load("String", "String"));

            lstElements.SelectedIndex = 0;
        }