ColoredCheckBox.cs 1.6 KB

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