Exemple #1
0
        public static ColorPalette.BasePalette PaintStyle(Form form, char style)
        {
            ColorPalette.BasePalette palette  = new ColorPalette.BasePalette();
            List <Control>           controls = new List <Control> {
                form
            };

            // Commonalities in style
            GetControls(form, controls);

            switch ((Style)style)
            {
            case Style.Neutral:
                palette = new ColorPalette.Neutral();
                break;

            case Style.Colonial:
                palette = new ColorPalette.Colonial();
                break;

            case Style.Warden:
                palette = new ColorPalette.Warden();
                break;
            }
            Paint(controls, palette);
            form.Invalidate();

            return(palette);
        }
Exemple #2
0
 private static void Paint(List <Control> controls, ColorPalette.BasePalette palette)
 {
     foreach (Control control in controls)
     {
         if (control is Form)
         {
             control.BackColor = palette.FormBackGround;
         }
         else if (control is Panel)
         {
             if (control is System.ComponentModel.IExtenderProvider)
             {
                 control.BackColor = control.Parent.BackColor;
             }
             else
             {
                 control.BackColor = palette.PanelBackGround;
             }
         }
         else if (control is Button)
         {
             Button button = control as Button;
             button.BackColor = palette.ButtonBackGround;
             button.FlatAppearance.BorderColor = palette.ButtonBorder;
             if (button is IToggleable)
             {
                 IToggleable toggleable = button as IToggleable;
                 toggleable.SelectedColor   = palette.Accent;
                 toggleable.DeselectedColor = palette.ButtonBackGround;
             }
         }
         else if (control is NumericUpDown)
         {
             control.BackColor = palette.FieldBackGround;
         }
         else
         {
             control.BackColor = control.Parent.BackColor;
         }
         control.ForeColor = palette.Text;
     }
 }
Exemple #3
0
        public MainForm()
        {
            InitializeComponent();

            m_btn_timer.Text = m_pop_timer;

            if (!string.IsNullOrEmpty(m_settings.TimeRemaining))
            {
                Text = Text + " - " + m_settings.TimeRemaining;
                AddActivationTimer();
            }

            palette = FormPainter.PaintStyle(this, m_settings.OptionTeam);

            Dictionary <string, Panel> button_panels = new Dictionary <string, Panel>();

            button_panels.Add(m_teams.First(), m_lyt_friend_buttons);
            button_panels.Add(m_teams.Last(), m_lyt_target_buttons);

            foreach (string team in m_teams)
            {
                // Construt inner structure
                m_locations[team] = new List <RenamableButton>();
                m_states[team]    = new Dictionary <RenamableButton, LocationState>();

                // Fill location structure
                Panel button_panel = button_panels[team];
                m_locations[team].AddRange(button_panel.Controls.OfType <RenamableButton>());

                // Fill state structure
                foreach (RenamableButton key in m_locations[team])
                {
                    m_states[team].Add(key, new LocationState());
                }

                m_locations[team].First().InitCheckedStatus();
            }
        }