How to use native RGB value to change Winform Button ForeColor?

How can I change the ForeColor buttons with my own RGB value (for example: 131; 160; 21) programmatically (not from the designer)? The R, G, and B properties in Button-control are the get property, not the set property.

I want to change it when the "Enabled" property is changed, and I also implemented an event handler for the EnabledChanged event.

Thanks in advance.

+7
source share
1 answer

Use the Color.FromArgb Method

 MyButton.ForeColor = Color.FromArgb(255,255,255); 

If you also need to control alpha, use the overloaded method .

+12
source

All Articles