mrvinent mrvinent - 14 days ago 5
C# Question

C# Custom SimpleButton change color

I have done a custom button using a Devexpress SimpleButton and I want to change the color of the button like this, but it doesn't work.

this.Button.ButtonStyle = DevExpress.XtraEditors.Controls.BorderStyles.Simple;
this.Button.BackColor = Color.Pink;


I have done the same with the designer and it works fine, but now i want to do it programmatically and it's not working. Thanks in advance.

Answer

Make sure to set LookAndFeel.Style to Flat, Ultra Flat or Style3D:

this.Button.LookAndFeel.Style = LookAndFeelStyle.Flat;
this.Button..LookAndFeel.UseDefaultLookAndFeel = false;
this.Button.Appearance.BackColor = Color.MediumSeaGreen;
this.Button.Appearance.Options.UseBackColor = true;
Comments