When a checkbox is checked the current fill colour is the accent colour. Material Design Lite (for one) uses the primary colour and it would be nice to have a choice. The following approach works OK although others might have alternate views on implementation.
Start with an Enum:
public enum FillColour { Primary, DarkPrimary, LightPrimary, Accent }
Add an attribute to the checkbox:
private FillColour checkedFillColour = FillColour.Accent; [Description("Fill colour for checked box"), Category("Behavior")] public FillColour CheckedFillColour { get { return checkedFillColour; } set { checkedFillColour = value; if (Checked) { Invalidate(); } } }
And then an addition to the short GetColor*\ functions in the skin manager class maybe:
public Color GetCheckBoxCheckedFillColor(FillColour checkedFillColour) { switch (checkedFillColour) { case FillColour.Accent: return colourScheme.AccentColor; case FillColour.DarkPrimary: return colourScheme.DarkPrimaryColor; case FillColour.LightPrimary: return colourScheme.LightPrimaryColor; default: return colourScheme.PrimaryColor; } }
and finally a tweak to the relevant line in the checkbox Paint:
var brush = new SolidBrush(Color.FromArgb(colorAlpha, Enabled ? GetCheckBoxCheckedFillColor(checkedFillColour) : GetCheckBoxOffDisabledColor()));
When a checkbox is checked the current fill colour is the accent colour. Material Design Lite (for one) uses the primary colour and it would be nice to have a choice. The following approach works OK although others might have alternate views on implementation.
Start with an Enum:
public enum FillColour { Primary, DarkPrimary, LightPrimary, Accent }
Add an attribute to the checkbox:private FillColour checkedFillColour = FillColour.Accent; [Description("Fill colour for checked box"), Category("Behavior")] public FillColour CheckedFillColour { get { return checkedFillColour; } set { checkedFillColour = value; if (Checked) { Invalidate(); } } }
And then an addition to the short GetColor*\ functions in the skin manager class maybe:public Color GetCheckBoxCheckedFillColor(FillColour checkedFillColour) { switch (checkedFillColour) { case FillColour.Accent: return colourScheme.AccentColor; case FillColour.DarkPrimary: return colourScheme.DarkPrimaryColor; case FillColour.LightPrimary: return colourScheme.LightPrimaryColor; default: return colourScheme.PrimaryColor; } }
and finally a tweak to the relevant line in the checkbox Paint:var brush = new SolidBrush(Color.FromArgb(colorAlpha, Enabled ? GetCheckBoxCheckedFillColor(checkedFillColour) : GetCheckBoxOffDisabledColor()));