这很简单。此示例假设您正在使用皮肤。
在主窗体调用的构造函数中:
DevExpress.Skins.SkinManager.EnableFormSkins();
这将使您的表单能够使用当前皮肤。从XtraForm派生的每个表单也很重要。
之后,您需要为您的应用程序设置全局外观对象:
//This set the style to use skin technology
DevExpress.LookAndFeel.UserLookAndFeel.Default.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Skin;
//Here we specify the skin to use by its name
DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle("Black");
如果您想像 Office 2003 一样设置应用程序的外观和感觉,则设置是不同的。您只需调用以下函数:
DevExpress.LookAndFeel.UserLookAndFeel.Default.SetOffice2003Style();
因此,devexpress 的每个控件都将使用这些设置来绘制自己。可以为某些控件指定自定义 LookAndFeel 对象,但我从未使用过它,因为我看不到为控件或表单提供自定义显示的意义。
Exception:
There is one exception in Devexpress framework. The NavBarControl does not use the skin technology automatically from your global LookAndFeel object, you need to specify a setting to enable that:
//To use the current skin
youNavBarControl.PaintStyleName = "SkinNavigationPane";
//To use the current look and feel without the skin
youNavBarControl.PaintStyleName = "NavigationPane";