How to change the default LookAndFeel for the entire application?

26,031

Solution 1

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;

Solution 2

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.

Solution 3

The following code should work for you:

 DevExpress.LookAndFeel.UserLookAndFeel.Default.SkinName = "Caramel"
 DevExpress.LookAndFeel.UserLookAndFeel.Default.UseWindowsXPTheme = False

Solution 4

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!

Share:
26,031
calico-cat
Author by

calico-cat

I have many interests - software development is one of them!

Updated on June 15, 2020

Comments

  • calico-cat
    calico-cat about 4 years

    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.LookAndFeel
    
    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?

  • calico-cat
    calico-cat over 13 years
    This is exactly what I have above, and it the default grey still loads in all forms. I'm putting it in main(). Can you elaborate? (I thought I followed your documentation...)
  • DevExpress Team
    DevExpress Team over 13 years
    I think that this code is overriden somewhere. Are you using the DefaultLookAndFeel control in your app? Perhaps its settings override the code above.
  • calico-cat
    calico-cat over 13 years
    I haven't explicitly changed it anywhere. I'm not using the control, but I can add it if it'll solve my problem :-p
  • calico-cat
    calico-cat over 13 years
    All forms are derived from XtraForm 10.2. This is turning out to be a real head-scratcher!
  • KtorZ
    KtorZ over 13 years
    The code i am using in my app is exactly this: DefaultLookAndFeel defaultLF = new DefaultLookAndFeel(); defaultLF.LookAndFeel.UseDefaultLookAndFeel = true; defaultLF.LookAndFeel.SkinName = "Caramel"; Maybe give this a try?