Esempio n. 1
0
        private void EnableDefault(bool enable, StyleItemConfig def)
        {
            var seq = Controls.OfType<Control>();

            seq.Where(c => c is CheckBox).OfType<CheckBox>()
               .ForEach(c => c.ThreeState = enable);

            seq.Where(c => c is ColorPicker).OfType<ColorPicker>()
               .ForEach(c => c.SetShowDefault(enable));

            if (enable)
            {
                fontCombo.AddDefault(def.FontName);
                sizeCombo.AddDefault(def.FontSize.ToString());
            }
            else
            {
                fontCombo.RemoveDefault();
                sizeCombo.RemoveDefault();
            }
        }
Esempio n. 2
0
        public static void ApplyStyle(this StyleItemConfig s, ScintillaControl sci)
        {
            var style = (Style)Reflect.GetPropertyValue(sci.Styles, s.Type);

            if (s.FontName != null)
            {
                style.Font = s.FontName;
            }

            if (s.FontSize != 0)
            {
                style.FontSize = s.FontSize;
            }

            if (s.ForeColor != null)
            {
                style.ForeColor = Color.FromKnownColor(s.ForeColor.Value);
            }

            if (s.BackColor != null)
            {
                style.BackColor = Color.FromKnownColor(s.BackColor.Value);
            }

            if (s.Bold != null)
            {
                style.Bold = s.Bold.Value;
            }

            if (s.Italic != null)
            {
                style.Italic = s.Italic.Value;
            }

            if (s.Underline != null)
            {
                style.Underline = s.Underline.Value;
            }
        }