Back to Devexpress

SkinManager Class

windowsforms-devexpress-dot-skins.md

latest5.6 KB
Original Source

SkinManager Class

Manages skins for DevExpress controls.

Namespace : DevExpress.Skins

Assembly : DevExpress.Utils.v25.2.dll

NuGet Packages : DevExpress.Utils, DevExpress.Wpf.Core

Declaration

csharp
public class SkinManager :
    ISkinManager
vb
Public Class SkinManager
    Implements ISkinManager

The following members return SkinManager objects:

Remarks

The SkinManager class provides the capability to load and register skins, and enable and disable the title bar skinning feature for DevExpress forms.

DevExpress forms (including the XtraForm, XtraMessageBox and various dialog and message boxes displayed by DevExpress controls) support title bar skinning. The following image shows a form painted using the Caramel skin with the title bar skinning feature enabled:

To enable the title bar skinning feature, apply a skinning painting scheme to the form via its LookAndFeel property, and call the SkinManager.EnableFormSkins/SkinManager.EnableFormSkinsIfNotVista method at runtime. Typically this method should be called on the application startup. See Skins to learn more.

To disable the form’s title bar skinning feature, call the SkinManager.DisableFormSkins method, and then call the DevExpress.LookAndFeel.LookAndFeelHelper.ForceDefaultLookAndFeelChanged method.

Title bar skinning for MDI child DevExpress forms can be enabled and disabled via the SkinManager.EnableMdiFormSkins and SkinManager.DisableMdiFormSkins methods, respectively. The use of these methods is equivalent to the SkinManager.EnableFormSkins and SkinManager.DisableFormSkins methods.

Specific skins are stored in external libraries (for instance, the Coffee, Liquid Sky and Stardust skins are stored in the DevExpress.BonusSkins library). These skins must be registered for runtime use. Otherwise, they are not available for DevExpress controls and forms. For information on registering skins stored in external libraries, see How To: Localize Bar and Ribbon Skin Items.

Example

The following code shows how to populate a combo box editor with names of available skins. When a specific item is selected from the editor’s dropdown, the corresponding skin is applied to controls.

To get the available skin names, the SkinManager.Skins property is used.

In this example, the selected skin is applied via the DefaultLookAndFeel object. It specifies look and feel settings used by all Developer Express controls and forms by default.

csharp
using DevExpress.XtraEditors;
using DevExpress.Skins;

// Handle the SelectedIndexChanged event to respond to selecting the skin name.
comboBoxEdit1.SelectedIndexChanged += new EventHandler(comboBoxEdit1_SelectedIndexChanged);
// Add available skin names to the combo box.
foreach(SkinContainer cnt in SkinManager.Default.Skins) {
    comboBoxEdit1.Properties.Items.Add(cnt.SkinName);
}

//...

void comboBoxEdit1_SelectedIndexChanged(object sender, EventArgs e) {
    ComboBoxEdit comboBox = sender as ComboBoxEdit;
    string skinName = comboBox.Text;
    DevExpress.LookAndFeel.UserLookAndFeel.Default.SkinName = skinName;
}
vb
Imports DevExpress.XtraEditors
Imports DevExpress.Skins

' Handle the SelectedIndexChanged event to respond to selecting the skin name.
AddHandler ComboBoxEdit1.SelectedIndexChanged, AddressOf comboBoxEdit1_SelectedIndexChanged
' Add available skin names to the combo box.
For Each cnt As SkinContainer In SkinManager.Default.Skins
    ComboBoxEdit1.Properties.Items.Add(cnt.SkinName)
Next cnt

'...

Sub comboBoxEdit1_SelectedIndexChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs)
    Dim comboBox As ComboBoxEdit = sender
    Dim skinName As String = comboBox.Text
    DevExpress.LookAndFeel.UserLookAndFeel.Default.SkinName = skinName
End Sub

Inheritance

Object SkinManager

See Also

SkinManager Members

WinForms Skins and Color Palettes

Look and Feel

Localize Skin Selectors

DevExpress.Skins Namespace