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);
        }
Example #2
0
        private void UpdateStyleList()
        {
            object selected = toolStyleList.SelectedItem;

            toolStyleList.Items.Clear();

            string[] styles = FormStyleManager.GetStyleNames();
            toolStyleList.Items.AddRange(styles);

            if (toolStyleList.Items.Count > 0)
            {
                if (selected != null)
                {
                    toolStyleList.SelectedItem = selected;
                }

                if (toolStyleList.SelectedIndex < 0)
                {
                    toolStyleList.SelectedIndex = 0;
                }
            }
            EnableTools();
        }