C#自定义SimpleButton改变颜色

C# Custom SimpleButton change color

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

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

我对设计器也做了同样的事情,它工作正常,但现在我想以编程方式进行,但它不起作用。提前致谢。

确保将 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;