2
0

ColoredCheckBox.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System;
  2. using System.Drawing;
  3. using System.Windows.Forms;
  4. namespace Optimizer
  5. {
  6. public class ColoredCheckBox : CheckBox
  7. {
  8. protected override void OnCheckedChanged(EventArgs e)
  9. {
  10. base.OnCheckedChanged(e);
  11. this.Tag = "themeable";
  12. // custom theming
  13. if (this.Checked)
  14. {
  15. this.Font = new Font(this.Font, FontStyle.Underline);
  16. switch (Options.CurrentOptions.Color)
  17. {
  18. case Theme.Caramel:
  19. this.ForeColor = Color.DarkOrange;
  20. break;
  21. case Theme.Lime:
  22. this.ForeColor = Color.LimeGreen;
  23. break;
  24. case Theme.Magma:
  25. this.ForeColor = Color.Tomato;
  26. break;
  27. case Theme.Minimal:
  28. this.ForeColor = Color.Gray;
  29. break;
  30. case Theme.Ocean:
  31. this.ForeColor = Color.DodgerBlue;
  32. break;
  33. case Theme.Zerg:
  34. this.ForeColor = Color.MediumOrchid;
  35. break;
  36. }
  37. }
  38. else
  39. {
  40. this.Tag = string.Empty;
  41. this.ForeColor = Color.White;
  42. this.Font = new Font(this.Font, FontStyle.Regular);
  43. }
  44. }
  45. }
  46. }