private void listStyles_IndexChanged(object sender, EventArgs e) { _suppressRefresh = true; int index = listBoxStyles.SelectedIndex; if (index >= 0) { ScriptStyle style = _styles[index]; comboBoxFonts.SelectedIndex = comboBoxFonts.Items.IndexOf(style.Font.Name); string size = Convert.ToString(style.Font.Size); comboBoxSizes.SelectedIndex = comboBoxSizes.Items.IndexOf(size); checkBoxBold.Checked = style.Font.Bold; checkBoxItalic.Checked = style.Font.Italic; checkBoxUnderline.Checked = style.Font.Underline; panelForeColor.BackColor = style.ForeColor; panelBackColor.BackColor = style.BackColor; _sampleScript.Scintilla.Text = _exampleStrings[index]; } _suppressRefresh = false; }
public void SetStyle(ScriptStyle[] styles) { if (_scintilla != null) { for (int i = 0; i < 19; i++) { if (i == 1) continue; _scintilla.Styles[i].ForeColor = styles[i].ForeColor; _scintilla.Styles[i].BackColor = styles[i].BackColor; _scintilla.Styles[i].Font = styles[i].Font; } // demoted keywords style _scintilla.Styles[29].ForeColor = _scintilla.Styles[5].ForeColor; _scintilla.Styles[29].BackColor = _scintilla.Styles[5].BackColor; _scintilla.Styles[29].Font = _scintilla.Styles[5].Font; // braces style _scintilla.Styles.BraceLight.ForeColor = styles[1].ForeColor; _scintilla.Styles.BraceLight.BackColor = styles[1].BackColor; _scintilla.Styles.BraceLight.Font = styles[1].Font; _scintilla.Styles.BraceBad.ForeColor = styles[1].BackColor; _scintilla.Styles.BraceBad.BackColor = styles[1].ForeColor; _scintilla.Styles.BraceBad.Font = styles[1].Font; // left margin style _scintilla.Styles.LineNumber.ForeColor = styles[19].ForeColor; _scintilla.Styles.LineNumber.BackColor = styles[19].BackColor; _scintilla.Styles.LineNumber.Font = styles[19].Font; _scintilla.Margins.FoldMarginColor = styles[19].BackColor; } }