为应用程序中所有控件提供共同的外观与感觉设置的最好方法,是使用 Default LookAndFeel(默认的外观与感觉)。 缺省时,所有控件都使用 Default LookAndFeel 设置。 控件仅在下列情况下不使用 Default LookAndFeel:
- 该控件的 UserLookAndFeel.UseDefaultLookAndFeel 属性值设置为 false
- 该控件的 UserLookAndFeel.UseDefaultLookAndFeel 属性值设置为 true, 并且一个 Parent LookAndFeel 对象被指派到了该控件的 LookAndFeel 对象。 注意,当控件被放置到 XtraForm 窗体中时,Parent LookAndFeel 被自动指派到控件的 LookAndFeel。
下列代码对 Default LookAndFeel 进行了定制,并且确保一个 XtraTabControl 使用由 Default LookAndFeel 公开的绘制设置。
C# | 复制代码 |
---|---|
using DevExpress.LookAndFeel; // Access the Default LookAndFeel. UserLookAndFeel defaultLF = UserLookAndFeel.Default; // Ensure that the Office2003 painting scheme will be used. defaultLF.UseWindowsXPTheme = false; defaultLF.Style = LookAndFeelStyle.Office2003; // Ensure that the Default LookAndFeel will be applied. xtraTabControl1.LookAndFeel.UseDefaultLookAndFeel = true; // Remove the Parent LookAndFeel (if any). xtraTabControl1.LookAndFeel.ParentLookAndFeel = null; |
Visual Basic | 复制代码 |
---|---|
Imports DevExpress.LookAndFeel ' Access the Default LookAndFeel. Dim defaultLF as UserLookAndFeel = UserLookAndFeel.Default ' Ensure that the Office2003 painting scheme will be used. defaultLF.UseWindowsXPTheme = False defaultLF.Style = LookAndFeelStyle.Office2003 ' Ensure that the Default LookAndFeel will be applied. XtraTabControl1.LookAndFeel.UseDefaultLookAndFeel = True ' Remove the Parent LookAndFeel (if any). XtraTabControl1.LookAndFeel.ParentLookAndFeel = Nothing |
如果显示如下: