I want to know how I can code a dark theme radio button that turns my entire C# windows form dark (including menus etc)
I made a separate settings form and I want to have radio buttons for themes that change the theme in the whole program, not just the settings menu. I'm making a text editor.
public void ChangeTheme(ColorScheme scheme, Control.ControlCollection container)
{
    foreach (Control component in container)
    {
        if (component is Panel)
        {
            ChangeTheme(scheme, component.Controls);
            component.BackColor = scheme.PanelBG;
            component.ForeColor = scheme.PanelFG;
        }
        else if (component is Button)
        {
            component.BackColor = scheme.ButtonBG;
            component.ForeColor = scheme.ButtonFG;
        }
        else if (component is TextBox)
        {
            component.BackColor = scheme.TextBoxBG;
            component.ForeColor = scheme.TextBoxFG;
        }
        ...
    }
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With