天下

记录修行的印记

Dev Express 一些Tips

Dev Express

Skin Libraries
Skins 
for DevExpress components are shipped in compiled libraries. To apply a skin, ensure that a corresponding library is added to the References section of your project.

Common Skins
The DevExpress.Utils.v15.
2.dll library contains common skins such as the DevExpress Style, Office 2013, VS2010, Office 2010 Blue, etc. This library is automatically added to the References section of your project when any DevExpress control/component is added to the form.

Extra Skins
Certain additional skins are available 
in the DevExpress.BonusSkins.v15.2.dll library, which must be manually added to the References section if you need to use any of these bonus skins.

Custom Skins
You can customize any common or extra skin by creating a custom skin 
using the WinForms Skin Editor utility. The WinForms Skin Editor creates a skin library (.dll) containing custom skins. The created library must be manually added to the References section of your project.

Note
To use any extra or custom skin at runtime, you need to add the skin library registration code. See the Bonus and Custom Skin Registration topic to learn more.
[STAThread]
static void Main() {
    
// Skin registration.
    DevExpress.UserSkins.BonusSkins.Register();
    Application.Run(
new Form1());
}


使动态皮肤即刻生效
It 
is possible to call the EnableFormSkins() method later, after the application startup. In this instance, the DevExpress.LookAndFeel.LookAndFeelHelper.ForceDefaultLookAndFeelChanged method needs to be called after the call to EnableFormSkins(). This forces the form's title bar to be repainted.
DevExpress.Skins.SkinManager.EnableFormSkins();
DevExpress.LookAndFeel.LookAndFeelHelper.ForceDefaultLookAndFeelChanged();
或者
DevExpress.Skins.SkinManager.DisableFormSkins();
DevExpress.LookAndFeel.LookAndFeelHelper.ForceDefaultLookAndFeelChanged();


动态换皮肤
//添加控件 comboBoxEdit1
public partial class Form1 :  DevExpress.XtraEditors.XtraForm
{
    
public Form1()
    {
        InitializeComponent();
        
foreach (SkinContainer cnt in SkinManager.Default.Skins)
            comboBoxEdit1.Properties.Items.Add(cnt.SkinName);
        comboBoxEdit1.SelectedIndexChanged 
+= new EventHandler(comboBoxEdit1_SelectedIndexChanged);
    }
    
void comboBoxEdit1_SelectedIndexChanged(object sender, EventArgs e)
    {
        ComboBoxEdit comboBox 
= sender as ComboBoxEdit;
        
string skinName = comboBox.Text;
        
//DevExpress.LookAndFeel.UserLookAndFeel.Default.SkinName = skinName;
        this.LookAndFeel.SkinName = skinName;
    }
}


//using DevExpress.XtraBars.Helpers;
    public partial class Form1 :  DevExpress.XtraEditors.XtraForm
    {
        
public Form1()
        {
            InitializeComponent();
            
this.barManager1.ForceInitialize();
            alertControl1.BeforeFormShow 
+= alertControl1_BeforeFormShow;

            
//禁止barManage右键显示
            this.barManager1.AllowCustomization = false;
            
this.barManager1.AllowShowToolbarsPopup = false;
            
//去除barManage右边小三角 自定制
            this.barManager1.AllowQuickCustomization = false;


            
this.LookAndFeel.UseDefaultLookAndFeel = true;
            
//添加一个BarSubItem DevExpress.XtraBars.BarSubItem mPaintStyle;
            
//添加换肤
            SkinHelper.InitSkinPopupMenu(mPaintStyle);

            
//标题栏支持皮肤
            DevExpress.Skins.SkinManager.EnableFormSkins();
        }
}

posted on 2016-07-21 09:54 天下 阅读(513) 评论(0)  编辑 收藏 引用 所属分类: C#


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


<2012年6月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

导航

统计

常用链接

留言簿(4)

随笔分类(378)

随笔档案(329)

链接

最新随笔

搜索

最新评论