要定制特定控件的外观与感觉,可以使用它的 LookAndFeel 属性。 例如,编辑器的外观与感觉设置,可以通过它的 BaseEdit.Properties 对象的 RepositoryItem.LookAndFeel 属性进行访问 (参阅 BaseEdit.Properties 对象)。 XtraNavBar 控件的外观与感觉则使用 NavBarControl.LookAndFeel 属性进行访问,等等。

下列代码把 "Liquid Sky" 皮肤应用到 ButtonEdit 控件。

C#CopyCode image复制代码
// Disable using the Default LookAndFeel.
buttonEdit1.Properties.LookAndFeel.UseDefaultLookAndFeel = false;
// Disable using the WindowsXP painting scheme.
buttonEdit1.Properties.LookAndFeel.UseWindowsXPTheme = false;
// Specify the skin to use.
buttonEdit1.Properties.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Skin;
buttonEdit1.Properties.LookAndFeel.SkinName = "Liquid Sky";

Visual BasicCopyCode image复制代码
' Disable using the Default LookAndFeel.
ButtonEdit1.Properties.LookAndFeel.UseDefaultLookAndFeel = False
' Disable using the WindowsXP painting scheme.
ButtonEdit1.Properties.LookAndFeel.UseWindowsXPTheme = False
' Specify the skin to use.
ButtonEdit1.Properties.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Skin
ButtonEdit1.Properties.LookAndFeel.SkinName = "Liquid Sky"
结果显示如下:

要为一组控件提供对外观与感觉设置的集中管理,可以使用下列方法之一:

下面的代码展示了如何使用 StyleController 组件为两个编辑器定制外观与感觉:
C#CopyCode image复制代码
using DevExpress.XtraEditors;
// Create and customize the Style Controller.
StyleController styleController1 = new StyleController();
// Set the background color.
styleController1.Appearance.BackColor = Color.LightYellow;
// Customize the LookAndFeel settings.
styleController1.LookAndFeel.UseDefaultLookAndFeel = false;
styleController1.LookAndFeel.UseWindowsXPTheme = true;
// Assign the StyleController to editors.
buttonEdit1.StyleController = styleController1;
lookUpEdit1.StyleController = styleController1;


Visual BasicCopyCode image复制代码
Imports DevExpress.XtraEditors

' Create and customize the Style Controller.
Dim styleController1 As StyleController = New StyleController()
' Set the background color.
styleController1.Appearance.BackColor = Color.LightYellow
' Customize the LookAndFeel settings.
styleController1.LookAndFeel.UseDefaultLookAndFeel = False
styleController1.LookAndFeel.UseWindowsXPTheme = True
' Assign the StyleController to editors.
ButtonEdit1.StyleController = styleController1
LookUpEdit1.StyleController = styleController1

结果显示如下: