devExpress 皮肤的使用

program.cs中代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using DevExpress.UserSkins;
using DevExpress.Skins;
using DevExpress.LookAndFeel;

namespace DXApplication1
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            BonusSkins.Register();
            SkinManager.EnableFormSkins();
            UserLookAndFeel.Default.SetSkinStyle("DevExpress Style");
            Application.Run(new MainForm());
        }
    }
}

可以有两种方式使用皮肤,如果form界面中有galleryControl,可以直接在galleryControl中显示出皮肤选项,cs文件中代码如下:

...
using DevExpress.Skins;
using DevExpress.LookAndFeel;
using DevExpress.UserSkins;
using DevExpress.XtraBars.Helpers;

namespace SkinsDemo
{
    public partial class Form1 : DevExpress.XtraEditors.XtraForm
    {
        public Form1()
        {
            InitializeComponent();
            InitSkinGallery();
        }
        void InitSkinGallery()
        {
            gallerySkins.Manager = barManager1;
            SkinHelper.InitSkinGalleryDropDown(gallerySkins, true);
        }
    }
}

另一种方法是将一个button设置成dropdown格式,然后创建一个galleryDropDown(命名为gallerySkins),button中DropDownControl设置为galleryDropDown,cs文件中代码如下:

 

 1 using DevExpress.Skins;
 2 using DevExpress.LookAndFeel;
 3 using DevExpress.UserSkins;
 4 using DevExpress.XtraBars.Helpers;
 5 
 6 namespace SkinsDemo
 7 {
 8     public partial class Form1 : DevExpress.XtraEditors.XtraForm
 9     {
10         public Form1()
11         {
12             InitializeComponent();
13             InitSkinGallery();
14         }
15         void InitSkinGallery()
16         {
17             gallerySkins.Manager = barManager1;
18             SkinHelper.InitSkinGalleryDropDown(gallerySkins, true);
19         }
20     }
21 }
22   
View Code

 

posted on 2014-08-28 16:56  木有鱼丸  阅读(813)  评论(0)    收藏  举报

导航