示例#1
0
 private void toolDeleteStyle_Click(object sender, EventArgs e)
 {
     if (ActiveStyle != null)
     {
         FormStyleManager.DeleteStyle(ActiveStyle);
     }
 }
示例#2
0
 private void SaveStyleLibrary()
 {
     saveFileDialog.FileName = FileName;
     if (saveFileDialog.ShowDialog() == DialogResult.OK)
     {
         try
         {
             FormStyleManager.Save(saveFileDialog.FileName);
             ClearDirtyFlag();
             FileName = saveFileDialog.FileName;
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
     }
 }
示例#3
0
        private void OpenStyleLibrary()
        {
            openFileDialog.FileName = FileName;

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    FormStyleManager.Load(openFileDialog.FileName);
                    FileName = openFileDialog.FileName;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
        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);
        }
示例#5
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();
        }
        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;
        }
示例#7
0
        private void toolAddStyle_Click(object sender, EventArgs e)
        {
            FormStyle style = FormStyleManager.AddNewStyle();

            toolStyleList.SelectedItem = style.Name;
        }
示例#8
0
 private void toolStyleList_SelectedIndexChanged(object sender, EventArgs e)
 {
     ActiveStyle = FormStyleManager.GetStyle((string)toolStyleList.SelectedItem);
 }
示例#9
0
 private void NewStyle()
 {
     FormStyleManager.Reset();
 }