windows now change theme immediately

This commit is contained in:
lempamo 2017-09-05 21:13:06 -04:00
parent 859e2483cb
commit 410b793a8b
5 changed files with 34 additions and 4 deletions

View file

@ -48,14 +48,17 @@ public static void ExtendedToolStripSeparator_Paint(object sender, PaintEventArg
public static Color GetLightFromColor(Color basecolor) public static Color GetLightFromColor(Color basecolor)
{ {
if (basecolor == Color.Silver) return Color.White;
if (basecolor == Color.FromArgb(112, 112, 112)) return Color.FromArgb(184, 184, 184); if (basecolor == Color.FromArgb(112, 112, 112)) return Color.FromArgb(184, 184, 184);
return ControlPaint.Light(basecolor, 50); if (basecolor == Color.FromArgb(169, 200, 169)) return Color.FromArgb(218, 223, 218);
return ControlPaint.Light(basecolor, 70);
} }
public static Color GetDarkFromColor(Color basecolor) public static Color GetDarkFromColor(Color basecolor)
{ {
if (basecolor == Color.FromArgb(112, 112, 112)) return Color.FromArgb(72, 72, 72); if (basecolor == Color.FromArgb(112, 112, 112)) return Color.FromArgb(72, 72, 72);
return ControlPaint.Dark(basecolor, 50); if (basecolor == Color.FromArgb(169, 200, 169)) return Color.FromArgb(95, 153, 95);
return ControlPaint.Dark(basecolor, 70);
} }
} }
} }

View file

@ -16,6 +16,7 @@ public WinClassic()
public Font fnt; public Font fnt;
public ResizeOverlay resizer = new ResizeOverlay(); public ResizeOverlay resizer = new ResizeOverlay();
public UserControl progContent;
public bool resizable = true; public bool resizable = true;
public bool closeDisabled = false; public bool closeDisabled = false;

View file

@ -127,6 +127,11 @@ public InsideComputerTheme()
asteriskSound = Properties.Resources.Win95PlusInsideComputerAsterisk; asteriskSound = Properties.Resources.Win95PlusInsideComputerAsterisk;
threeDObjectsColor = Color.FromArgb(169, 200, 169);
threeDObjectsTextColor = Color.Black;
buttonFont = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Bold);
activeTitleBarColor = Color.FromArgb(224, 0, 0); activeTitleBarColor = Color.FromArgb(224, 0, 0);
activeTitleTextColor = Color.White; activeTitleTextColor = Color.White;
inactiveTitleBarColor = Color.FromArgb(96, 168, 128); inactiveTitleBarColor = Color.FromArgb(96, 168, 128);

View file

@ -60,6 +60,7 @@ public WinClassic Init(UserControl content, string title, Image icon, bool MaxBu
content.Parent = app.programContent; content.Parent = app.programContent;
content.BringToFront(); content.BringToFront();
content.Dock = DockStyle.Fill; content.Dock = DockStyle.Fill;
app.progContent = content;
// Check if icon is null // Check if icon is null
if (icon == null) if (icon == null)

View file

@ -96,7 +96,17 @@ private void applyButton_Click(object sender, EventArgs e)
((WinClassic)f).Title.ForeColor = SaveSystem.currentTheme.inactiveTitleTextColor; ((WinClassic)f).Title.ForeColor = SaveSystem.currentTheme.inactiveTitleTextColor;
} }
f.Invalidate(); f.Invalidate();
foreach (Control c in f.Controls) c.Invalidate(); ((WinClassic)f).programContent.Invalidate();
((WinClassic)f).top.Invalidate();
((WinClassic)f).toprightcorner.Invalidate();
((WinClassic)f).right.Invalidate();
((WinClassic)f).bottomrightcorner.Invalidate();
((WinClassic)f).bottom.Invalidate();
((WinClassic)f).bottomleftcorner.Invalidate();
((WinClassic)f).left.Invalidate();
((WinClassic)f).topleftcorner.Invalidate();
foreach (Control c in ((WinClassic)f).progContent.Controls) c.Invalidate();
((WinClassic)f).progContent.BackColor = SaveSystem.currentTheme.threeDObjectsColor;
} }
} }
} }
@ -139,7 +149,17 @@ private void okButton_Click(object sender, EventArgs e)
((WinClassic)f).Title.ForeColor = SaveSystem.currentTheme.inactiveTitleTextColor; ((WinClassic)f).Title.ForeColor = SaveSystem.currentTheme.inactiveTitleTextColor;
} }
f.Invalidate(); f.Invalidate();
foreach (Control c in f.Controls) c.Invalidate(); ((WinClassic)f).programContent.Invalidate();
((WinClassic)f).top.Invalidate();
((WinClassic)f).toprightcorner.Invalidate();
((WinClassic)f).right.Invalidate();
((WinClassic)f).bottomrightcorner.Invalidate();
((WinClassic)f).bottom.Invalidate();
((WinClassic)f).bottomleftcorner.Invalidate();
((WinClassic)f).left.Invalidate();
((WinClassic)f).topleftcorner.Invalidate();
foreach (Control c in ((WinClassic)f).progContent.Controls) c.Invalidate();
((WinClassic)f).progContent.BackColor = SaveSystem.currentTheme.threeDObjectsColor;
} }
} }
ParentForm.Close(); ParentForm.Close();