Ejemplo n.º 1
0
        internal static FormStyle AddNewStyle()
        {
            FormStyle style = new FormStyle();

            if (globalStyleLibrary == null)
            {
                globalStyleLibrary = new FormStyleLibrary();
            }

            List <string> styleNames = new List <string>(FormStyleManager.GetStyleNames());

            style.Name = "FormStyle";
            for (int i = 1; styleNames.Contains(style.Name); i++)
            {
                style.Name = String.Format("FormStyle{0}", i);
            }

            globalStyleLibrary.Styles.Add(style);
            OnStyleChanged();

            return(style);
        }
Ejemplo n.º 2
0
        private void UpdateActiveFormStyle()
        {
            FormStyle style = null;

            if (UseFormStyleManager)
            {
                // try to load specified style
                if (!String.IsNullOrEmpty(FormStyleName))
                {
                    style = FormStyleManager.GetStyle(FormStyleName);
                }

                // if it wasn't found try to load default style
                if (style == null)
                {
                    style = FormStyleManager.GetDefaultStyle();
                }
            }
            else
            {
                style = FormStyle;
            }
            ActiveFormStyle = style;
        }