C# 自定义SimpleButton改变颜色

mrv*_*ent 0 c# devexpress simplebutton

我已经使用 Devexpress SimpleButton 完成了一个自定义按钮,我想像这样更改按钮的颜色,但它不起作用。

        this.Button.ButtonStyle = DevExpress.XtraEditors.Controls.BorderStyles.Simple;
        this.Button.BackColor = Color.Pink;
Run Code Online (Sandbox Code Playgroud)

我对设计师做了同样的事情,它工作得很好,但现在我想以编程方式完成它,但它不起作用。提前致谢。

abd*_*dul 5

确保设置LookAndFeel.Style为 Flat、Ultra Flat 或 Style3D:

this.Button.LookAndFeel.Style = LookAndFeelStyle.Flat;
this.Button.LookAndFeel.UseDefaultLookAndFeel = false;
this.Button.Appearance.BackColor = Color.MediumSeaGreen;
this.Button.Appearance.Options.UseBackColor = true;
Run Code Online (Sandbox Code Playgroud)