Back to Devexpress

How to: Customize Look And Feel of Specific Control(s)

windowsforms-2411-common-features-application-appearance-and-skin-colors-look-and-feel-how-to-customize-look-and-feel-of-specific-controls.md

latest4.1 KB
Original Source

How to: Customize Look And Feel of Specific Control(s)

  • May 13, 2024
  • 2 minutes to read

DevExpress controls are rendered using global look-and-feel settings, which are exposed by the Default LookAndFeel object. This allows you to apply the same paint scheme to all forms in your WinForms application.

Use a control’s LookAndFeel property to override default look-and-feel settings:

  1. Set the control’s LookAndFeel.UseDefaultLookAndFeel property to false to ignore default (global) settings.
  2. Customize the control’s LookAndFeel settings as needed.

The following example applies the “Office 2019 Black” skin to the ‘Cancel’ button (ButtonEdit):

csharp
using DevExpress.LookAndFeel;

namespace DXApplication {
    public partial class Form1 : DevExpress.XtraEditors.XtraForm {
        public Form1() {
            InitializeComponent();
            /* Specifies the default skin (the 'Basic' skin).
               The default skin is applied to all UI controls displayed on the Form.*/
            UserLookAndFeel.Default.SetSkinStyle(SkinStyle.Basic);

            // Disables the default look-and-feel settings for the 'Cancel' button.
            buttonCancel.LookAndFeel.UseDefaultLookAndFeel = false;
            // Specifies the 'Office 2019 Black' skin for the 'Cancel' button.
            buttonCancel.LookAndFeel.SkinName = SkinStyle.Office2019Black;
        }
    }
}
vb
Imports DevExpress.LookAndFeel

Namespace DXApplication
    Partial Public Class Form1
        Inherits DevExpress.XtraEditors.XtraForm

        Public Sub New()
            InitializeComponent()
' Specifies the default skin (the 'Basic' skin).
' The default skin is applied to all UI controls displayed on the Form.
            UserLookAndFeel.Default.SetSkinStyle(SkinStyle.Basic)

            ' Disables the default look-and-feel settings for the 'Cancel' button.
            buttonCancel.LookAndFeel.UseDefaultLookAndFeel = False
            ' Specifies the 'Office 2019 Black' skin for the 'Cancel' button.
            buttonCancel.LookAndFeel.SkinName = SkinStyle.Office2019Black
        End Sub
    End Class
End Namespace

You can also use DX Skin Colors to visually highlight specific DevExpress controls (for example, buttons):

csharp
using DevExpress.LookAndFeel;

namespace DXApplication22 {
    public partial class Form1 : DevExpress.XtraEditors.XtraForm {
        public Form1() {
            InitializeComponent();
            UserLookAndFeel.Default.SetSkinStyle(SkinStyle.Basic);

            buttonCancel.Appearance.BackColor = DXSkinColors.FillColors.Danger;
            buttonSave.Appearance.BackColor = DXSkinColors.FillColors.Success;
        }
    }
}
vb
Imports DevExpress.LookAndFeel

Namespace DXApplication22
    Partial Public Class Form1
        Inherits DevExpress.XtraEditors.XtraForm

        Public Sub New()
            InitializeComponent()
            UserLookAndFeel.Default.SetSkinStyle(SkinStyle.Basic)

            buttonCancel.Appearance.BackColor = DXSkinColors.FillColors.Danger
            buttonSave.Appearance.BackColor = DXSkinColors.FillColors.Success
        End Sub
    End Class
End Namespace

See Also

How to: Customize Look And Feel of All Controls within Application

How to: Customize Look And Feel of All Controls within Form