Пример #1
0
        public static Dictionary <string, object> GetStyle(Type controlType,
                                                           BaseStyle.EPresetStyle presetStyle = BaseStyle.EPresetStyle.Default)
        {
            if (_dicStructStyles == null)
            {
                _dicStructStyles = new Dictionary <string, StructStyle>();
                InitStyle();
            }

            if (presetStyle == BaseStyle.EPresetStyle.None || !_dicStructStyles.ContainsKey(presetStyle.ToString()))
            {
                return(null);
            }

            if (typeof(MagicianForm).IsAssignableFrom(controlType))
            {
                return(_dicStructStyles[presetStyle.ToString()].FormStyle.GetStyle());
            }

            if (typeof(MagicianTextBox).IsAssignableFrom(controlType))
            {
                return(_dicStructStyles[presetStyle.ToString()].TextBoxStyle.GetStyle());
            }
            return(null);
        }
Пример #2
0
 public static void ApplyControlStyle <T>(this T model, BaseStyle.EPresetStyle presetStyle) where T : Control
 {
     model.ApplyProp(StyleManager.GetStyle(typeof(T), presetStyle));
 }