How to change the default LookAndFeel for the entire application?
This page lists a way to change the default LookandFeel for a .net application using DevExpress 10.2. It's not working for me.
My code (in Main()
)
imports DevExpress.LookAndFe开发者_高级运维el
DevExpress.LookAndFeel.UserLookAndFeel.Default.SkinName = "Caramel"
DevExpress.LookAndFeel.UserLookAndFeel.Default.UseWindowsXPTheme = False
DevExpress.LookAndFeel.UserLookAndFeel.Default.LookAndFeelStyle.Office2003
My users hate this new grey theme and want Caramel back... suggestions?
Your code should work. But you have to make sure that all your forms are derived from DevExpress.XtraEditors.XtraForm (for a Winforms-Application). Otherwise the LookAndFeel will not be propagated to the controls on the forms. In general: if you place a devexpress control in a container that is not derived from a devexpress container the look-and-feel will not change.
Edit: the original question & answer was for DevExpress v 10.x. Starting with DevExpress V 2011.2 you need to reference a "DevExpress.BonusSkins.vXX.Y"-library in your project and register the bonus skins via
DevExpress.UserSkins.BonusSkins.Register();
The bonus skin libraries are called e.g. "DevExpress.BonusSkins.v12.1.DLL" and can be found in the "\Bin\Framework"-Folder of your DevExpress-installation.
Complete code would look like:
DevExpress.UserSkins.BonusSkins.Register();
DefaultLookAndFeel defaultLF = new DefaultLookAndFeel();
defaultLF.LookAndFeel.UseDefaultLookAndFeel = true;
When you create a project that uses any Developer Express component, a reference to the DevExpress.Utils
library is added to it. This library contains helper classes common to all components and also provides some default skins
(e.g. DevExpress Style, Metropolis, VS2010, Office 2010 Blue, etc.).
Other skins
(Caramel, Coffee, Liquid Sky, Stardust, etc.)
are implemented in the DevExpress.BonusSkins library
To register skins shipped with the DevExpress.BonusSkins library, call the static Register method of the DevExpress.UserSkins.BonusSkins
class.
[STAThread]
static void Main() {
// Skin registration.
DevExpress.UserSkins.BonusSkins.Register();
Application.Run(new Form1());
}
See this link for more details.
The following code should work for you:
DevExpress.LookAndFeel.UserLookAndFeel.Default.SkinName = "Caramel"
DevExpress.LookAndFeel.UserLookAndFeel.Default.UseWindowsXPTheme = False
After i read much, i did like this and run me perfect!
1 - Create a module and write this code:
Imports DevExpress.LookAndFeel Module Program <STAThread()> _ Public Sub Main() DevExpress.UserSkins.BonusSkins.Register() DevExpress.UserSkins.OfficeSkins.Register() DevExpress.LookAndFeel.UserLookAndFeel.Default.UseWindowsXPTheme = False DevExpress.LookAndFeel.UserLookAndFeel.Default.UseDefaultLookAndFeel = True DevExpress.LookAndFeel.UserLookAndFeel.Default.SkinName = "Caramel" 'For Example! DevExpress.Skins.SkinManager.EnableMdiFormSkins() DevExpress.Skins.SkinManager.EnableFormSkins() Application.Run(New Form1) End Sub End Module
2 - And OBVIOUSLY Change this line in each form (Form1.Designer.vb):
Partial Class Form1 REM Inherits System.Windows.Forms.Form Inherits DevExpress.XtraEditors.XtraForm End Class
Good luck!
Try setting the LookAndFeelStyle to "Skin":
DevExpress.LookAndFeel.UserLookAndFeel.Default.LookAndFeelStyle.Skin
精彩评论