How can I change the Buttons's ForeColor with my own RGB value (example: 131;160;21) programmatically (not from designer)? The property R, G and B in Button-control are only "get" property and not "set".
I want to change it when the "Enabled" property is changed and I have also implemented event handler for EnabledChanged event.
Thank you in advance.
Step 2: Drag the Button control from the ToolBox and drop it on the windows form. You are allowed to place a Button control anywhere on the windows form according to your need. Step 3: After drag and drop you will go to the properties of the Button control to set the BackColor property of the Button.
The BackColor property is an ambient property. An ambient property is a control property that, if not set, is retrieved from the parent control. For example, a Button will have the same BackColor as its parent Form by default.
The CSS background-color property allows you to change the background color of an HTML element.
Using BackColor property you can set the background color of the button. Using BackgroundImage property you can set the background image on the button.
Use Color.FromArgb
Method
MyButton.ForeColor = Color.FromArgb(255,255,255);
If you need to control the alpha too, use the overloaded method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With