ColoredRadioButton.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. using System.Drawing;
  3. using System.Windows.Forms;
  4. namespace Optimizer
  5. {
  6. public class ColoredRadioButton : RadioButton
  7. {
  8. public ColoredRadioButton()
  9. {
  10. DoubleBuffered = true;
  11. }
  12. protected override void OnCheckedChanged(EventArgs e)
  13. {
  14. base.OnCheckedChanged(e);
  15. // custom theming
  16. if (this.Checked)
  17. {
  18. this.Tag = "themeable";
  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. }