Esempio n. 1
0
        private void SetDarkMode(bool dark, bool alternative)
        {
            darkMode = dark;
            alternativeAppearance = alternative;

            if (dark)
            {
                base.BackColor = alternative ? ThemeMan.DarkMainColor : ThemeMan.DarkBackColor;
            }
            else
            {
                base.BackColor = alternative ? ThemeMan.LightMainColor : ThemeMan.LightBackColor;
            }

            foreach (var c in Items)
            {
                if (c.GetType() == typeof(QlibToolsep))
                {
                    (c as QlibToolsep).DarkMode = dark;
                }
                else if (c.GetType() == typeof(ToolStripDropDownButton))
                {
                    if (dark)
                    {
                        (c as ToolStripDropDownButton).DropDown.BackColor = ThemeMan.DarkSecondColor;
                        (c as ToolStripDropDownButton).DropDown.ForeColor = Color.White;
                    }
                    else
                    {
                        (c as ToolStripDropDownButton).DropDown.BackColor = ThemeMan.LightSecondColor;
                        (c as ToolStripDropDownButton).DropDown.ForeColor = Color.Black;
                    }

                    foreach (var c2 in (c as ToolStripDropDownButton).DropDownItems)
                    {
                        if (c2.GetType() == typeof(ToolStripMenuItem))
                        {
                            if (dark)
                            {
                                (c2 as ToolStripMenuItem).DropDown.BackColor = ThemeMan.DarkSecondColor;
                                (c2 as ToolStripMenuItem).DropDown.ForeColor = Color.White;
                            }
                            else
                            {
                                (c2 as ToolStripMenuItem).DropDown.BackColor = ThemeMan.LightSecondColor;
                                (c2 as ToolStripMenuItem).DropDown.ForeColor = Color.Black;
                            }
                        }
                    }
                }
            }

            Renderer = new CustomToolStripSystemRenderer(dark);
        }
Esempio n. 2
0
        private void SetDarkMode(bool dark)
        {
            darkMode = dark;

            if (dark)
            {
                base.BackColor = ThemeMan.DarkSecondColor;
            }
            else
            {
                base.BackColor = ThemeMan.LightSecondColor;
            }

            foreach (var c in Items)
            {
                if (c.GetType() == typeof(ToolStripMenuItem))
                {
                    if (dark)
                    {
                        (c as ToolStripMenuItem).BackColor          = ThemeMan.DarkSecondColor;
                        (c as ToolStripMenuItem).ForeColor          = Color.White;
                        (c as ToolStripMenuItem).DropDown.BackColor = ThemeMan.DarkSecondColor;
                        (c as ToolStripMenuItem).DropDown.ForeColor = Color.White;
                    }
                    else
                    {
                        (c as ToolStripMenuItem).BackColor          = ThemeMan.LightSecondColor;
                        (c as ToolStripMenuItem).ForeColor          = Color.Black;
                        (c as ToolStripMenuItem).DropDown.BackColor = ThemeMan.LightSecondColor;
                        (c as ToolStripMenuItem).DropDown.ForeColor = Color.Black;
                    }
                }
            }

            Renderer = new CustomToolStripSystemRenderer(dark);
        }