Visual Studio C# MetroFramework MetroButton change Back Color -
i looking possibility change button backcolor on button click or on timer.
using metroframework ok; form style set metroform , objects usable.
i have found code doesn´t work.
using metroframework.forms; using metroframework.drawing; using metroframework.controls; using system.drawing; private void metrobutton1_click(object sender, eventargs e) { //metrobutton1.backcolor = color.green; metrobutton1.backcolor = system.drawing.color.aliceblue; metrobutton1.text = "button click"; //metrobutton1.backcolor.system.drawing.color.darkgray;
according source code of metrobutton
class (on github), there property:
private bool usecustombackcolor= false; [defaultvalue(false)] [category(metrodefaults.propertycategory.appearance)] public bool usecustombackcolor { { return usecustombackcolor; } set { usecustombackcolor = value; } }
if property false in onpaintbackground(painteventargs e)
there code sets default background color:
if (!usecustombackcolor) { backcolor = metropaint.backcolor.button.normal(theme); }
setting usecustombackcolor
should solve problem
Comments
Post a Comment