We have a Windows Forms project with quite a few FlatStyle buttons.
When we disable the buttons, the colors of the buttons are changed automatically Frown | :(
Is it possible to override this somehow, so we can control the colors ourselves?
We have a Windows Forms project with quite a few FlatStyle buttons.
When we disable the buttons, the colors of the buttons are changed automatically Frown | :(
Is it possible to override this somehow, so we can control the colors ourselves?
I use ClientRectangle instead of e.ClipRectangle to avoid clip effect when the button is partialy repaint :
I followed the following approach :- The Click() event of the button can be controlled using custom variable.
This way the button doesn't even need to be disabled. The button still has the click feel but no action will be taken. Have to use the right colors to communicate that the button is disabled.
To get less-fuzzy text, use the TextRenderer class instead:
And the Button1_EnabledChanged method as in Harsh's answer.
You need to use the EnabledChanged event to set the desired color. Here is an example.
Use the desired colors according to your requirement.
Also you need to use the paint event.