private void setUnderlineColour(ColourComboBox box) { Color colour2; foreach (var style in selectedStyles) { if (style is Config.UnderlineStyle) { ((Config.UnderlineStyle)style).UnderlineColour = box.DefaultSelected ? (Color?)null : box.Color; } } var errorIndex = editorColoursSampleTextBox.GetStyleIndex(MslSyntaxHighlighter.ErrorStyle); var warningIndex = editorColoursSampleTextBox.GetStyleIndex(MslSyntaxHighlighter.WarningStyle); var noticeIndex = editorColoursSampleTextBox.GetStyleIndex(MslSyntaxHighlighter.NoticeStyle); // WavyLineStyles are immutable, so we must create new ones. if (editorStyleList.GetSelected(10)) { MslSyntaxHighlighter.ErrorStyle = new WavyLineStyle(box.Color.A, box.Color); } if (editorStyleList.GetSelected(11)) { MslSyntaxHighlighter.WarningStyle = new WavyLineStyle(box.Color.A, box.Color); } if (editorStyleList.GetSelected(12)) { MslSyntaxHighlighter.NoticeStyle = new WavyLineStyle(box.Color.A, box.Color); } if (errorIndex >= 0) { editorColoursSampleTextBox.Styles[errorIndex] = MslSyntaxHighlighter.ErrorStyle; } if (warningIndex >= 0) { editorColoursSampleTextBox.Styles[warningIndex] = MslSyntaxHighlighter.WarningStyle; } if (noticeIndex >= 0) { editorColoursSampleTextBox.Styles[noticeIndex] = MslSyntaxHighlighter.NoticeStyle; } //Rehighlight((MslDocument) editorColoursSampleTextBox.Tag); editorColoursSampleTextBox.Refresh(); }
private void setForegroundColour(ColourComboBox box) { for (int i = 0; i < selectedStyles.Count; ++i) { if (selectedStyles[i] is Config.TextStyle) { var configStyle = (Config.TextStyle)selectedStyles[i]; configStyle.TextColour = box.DefaultSelected ? (Color?)null : box.Color; if (selectedStyles2[i] != null) { var textStyle = (TextStyle)selectedStyles2[i]; textStyle.ForeBrush = (box.InitialSelected || box.Color.IsEmpty ? null : new SolidBrush(box.Color)); } } } if (editorStyleList.GetSelected(0)) { setNormalForegroundColour(); } editorColoursSampleTextBox.Refresh(); }