Beispiel #1
0
        private void HandleControl(Control control, Dictionary <Type, ColorSet> colorSet)
        {
            FirefoxButton   button    = control as FirefoxButton;
            PanelBox        pb        = control as PanelBox;
            LinkLabel       linkLabel = control as LinkLabel;
            FirefoxCheckBox cb        = control as FirefoxCheckBox;

            if (button != null && colorSet.ContainsKey(button.GetType()))
            {
                var colorset = colorSet[button.GetType()];
                button.BackColor         = colorset.BackColor.Value;
                button.BackColorOverride = colorset.BackColor.Value;
                button.ForeColor         = colorset.ForeColor.Value;
                button.HoverColor        = colorset.HoverColor.Value;
                button.HoverForeColor    = colorset.HoverForeColor.Value;
            }
            else if (pb != null && colorSet.ContainsKey(pb.GetType()))
            {
                var colorset = colorSet[pb.GetType()];
                pb.BackColor   = colorset.BackColor.Value;
                pb.ForeColor   = colorset.ForeColor.Value;
                pb.HeaderColor = colorset.HeaderColor.Value;
            }
            else if (linkLabel != null && colorSet.ContainsKey(linkLabel.GetType()))
            {
                var colorset = colorSet[linkLabel.GetType()];
                linkLabel.BackColor = colorset.BackColor.Value;
                linkLabel.ForeColor = colorset.ForeColor.Value;
                linkLabel.LinkColor = colorset.LinkColor.Value;
            }
            else
            {
                if (colorSet.ContainsKey(control.GetType()))
                {
                    var colorset = colorSet[control.GetType()];
                    control.BackColor = colorset.BackColor ?? control.BackColor;
                    control.ForeColor = colorset.ForeColor ?? control.ForeColor;
                }
                else
                {
                    var colorset = colorSet[typeof(Control)];
                    control.BackColor = colorset.BackColor ?? control.BackColor;
                    control.ForeColor = colorset.ForeColor ?? control.ForeColor;
                }
            }

            if (cb != null)
            {
                cb.IsDarkMode = !_isLightMode;
            }

            control.Invalidate();
            control.Update();
        }
Beispiel #2
0
        private static void It(System.Windows.Forms.Control.ControlCollection collection)
        {
            foreach (Control control in collection)
            {
                It(control.Controls);

                TextBox            tb     = control as TextBox;
                FirefoxCheckBox    cb     = control as FirefoxCheckBox;
                FirefoxRadioButton rb     = control as FirefoxRadioButton;
                GroupBox           gb     = control as GroupBox;
                FirefoxButton      button = control as FirefoxButton;
                PanelBox           pb     = control as PanelBox;
                Label label = control as Label;

                if (tb != null)
                {
                    tb.Text = Reverse(tb.Text);
                }
                if (cb != null)
                {
                    cb.Text = Reverse(cb.Text);
                }
                if (rb != null)
                {
                    rb.Text = Reverse(rb.Text);
                }
                if (gb != null)
                {
                    gb.Text = Reverse(gb.Text);
                }
                if (button != null)
                {
                    button.Text = Reverse(button.Text);
                }
                if (pb != null)
                {
                    pb.Text = Reverse(pb.Text);
                }
                if (label != null)
                {
                    label.Text = Reverse(label.Text);
                }
            }
        }
Beispiel #3
0
        private void FetchRegularColors(Control.ControlCollection collection)
        {
            foreach (Control control in collection)
            {
                FetchRegularColors(control.Controls);

                FirefoxButton button    = control as FirefoxButton;
                PanelBox      pb        = control as PanelBox;
                LinkLabel     linkLabel = control as LinkLabel;

                if (button != null)
                {
                    _regularColors[typeof(FirefoxButton)] = new ColorSet {
                        BackColor      = button.BackColor,
                        ForeColor      = button.ForeColor,
                        HoverColor     = button.HoverColor,
                        HoverForeColor = button.HoverForeColor
                    };
                }
                else if (pb != null)
                {
                    _regularColors[typeof(PanelBox)] = new ColorSet {
                        BackColor   = pb.BackColor,
                        ForeColor   = pb.ForeColor,
                        HeaderColor = pb.HeaderColor
                    };
                }
                else if (linkLabel != null)
                {
                    _regularColors[typeof(LinkLabel)] = new ColorSet {
                        BackColor = linkLabel.BackColor,
                        ForeColor = linkLabel.ForeColor,
                        LinkColor = linkLabel.LinkColor
                    };
                }
                else
                {
                    _regularColors[control.GetType()] = new ColorSet {
                        BackColor = control.BackColor,
                        ForeColor = control.ForeColor
                    };
                }
            }
        }