DevExpress.XtraBars.Helpers.SkinHelper类允许您填充现有RibbonGalleryBarItem或任意菜单(PopupMenu或BarSubItem)项目对应的DevExpress皮肤。如果最终用户单击任何项目,相应的皮肤就会通过静态的 Default Look and Feel对象得到应用。下面,我们就给出一个具体的事例:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraBars.Ribbon;
using DevExpress.XtraBars.Helpers;
using DevExpress.XtraBars.Localization; namespace HowToUseBarSkinHelper {
public partial class Form1 : RibbonForm {
public Form1() {
InitializeComponent();
} private void Form1_Load(object sender, EventArgs e) {
BarLocalizer.Active = new MyBarLocalizer(); SkinHelper.InitSkinGallery(ribbonGalleryBarItem1, true);
SkinHelper.InitSkinPopupMenu(popupMenu1);
}
} // Custom localizer that changes skin captions
public class MyBarLocalizer : BarLocalizer {
public override string GetLocalizedString(BarString id) {
if (id == BarString.SkinCaptions) {
//Default value for BarString.SkinCaptions:
//"|DevExpress Style|Caramel|Money Twins|DevExpress Dark Style|iMaginary|Lilian|Black|Blue|Office 2010 Blue|Office 2010 Black|Office 2010 Silver|Office 2007 Blue|Office 2007 Black|Office 2007 Silver|Office 2007 Green|Office 2007 Pink|Seven|Seven Classic|Darkroom|McSkin|Sharp|Sharp Plus|Foggy|Dark Side|Xmas (Blue)|Springtime|Summer|Pumpkin|Valentine|Stardust|Coffee|Glass Oceans|High Contrast|Liquid Sky|London Liquid Sky|The Asphalt World|Blueprint|"
string defaultSkinCaptions = base.GetLocalizedString(id);
string newSkinCaptions = defaultSkinCaptions.Replace("|DevExpress Style|", "|My Favorite Skin|");
return newSkinCaptions;
}
return base.GetLocalizedString(id);
} }
}

DevExpress如何实现皮肤的添加及本地化的更多相关文章

  1. 使用DevExpress改变WinForm皮肤(VS)

    基于步入DevExpress的使用(VS),进一步使用DevExpress改变WinForm皮肤,适合初学者. 提示: 1.对于DevExpress菜单中的RepositoryItemComboBox ...

  2. DevExpress winform 友好皮肤

    DevExpress设置默认皮肤及各种皮肤样式   DevExpress设置默认皮肤及各种皮肤样式 设置默认皮肤代码: 在程序入口Program.cs里添加如下代码 引用using DevExpres ...

  3. Winform中使用DevExpress时给控件添加子控件的方法

    场景 在WInform中使用DevExpress时经常使用PanelControl控件用来进行布局设计,因此需要在代码中生成控件并添加子控件. 实现 一种是设置要添加的自控件的Parent属性为容器控 ...

  4. DevExpress Ribbongallerybaritem选择性皮肤重组

    void InitSkinGallery() () { SkinHelper skinHelper = new SkinHelper(); RibbonControl masterRibbonCont ...

  5. 博客主题皮肤探索-添加新功能和fiddler的css/js替换

    还有前言 使用了主题之后,发现还差了一点功能.最新评论没有了,导致读者回复需要一点时间去找到底回复了哪条博客.于是就有了添加功能的想法. 如何调试CSS/JS 打开f12,可以看见加载的js资源都是混 ...

  6. 博客主题皮肤探索-主题的本地化和ChromeCacheView使用

    还有前言 用了大佬的主题之后,有些资源是无法在暴露的接口处更改的,需要自己去css更改.但后台给的都是压缩过的,找起来比较困难,所以特意记录了这篇. 本地资源替换 侧边栏: .introduce-bo ...

  7. Devexpress -换皮肤

    一.在项目下新建RibbonForm  命名为:useSkin 二.添加引用DevExpress.OfficeSkins      DevExpress.UserSkins.BonusSkins 三. ...

  8. VS工具箱中添加DevExpress控件

    关闭所有VS进程: ①使用控制台进入DevExpress安装目录: D:\DevExpress\Components\Tools\ ②添加DevExpress控件:ToolboxCreator.exe ...

  9. DevExpress Skins<2>

    Skins DevExpress WinForms控件包括许多现成的绘画主题(或外观),用于更改DevExpress表单和控件的外观.您可以通过运行WinForms演示应用程序并使用外观选择器在可用主 ...

随机推荐

  1. Apache Mina UDP连接目标服务器地址时出现异常

    俩种情形,第一种是开始连接时候就没连上服务器:第二种是服务器关闭连接,出现的异常: 第一种: java.lang.reflect.InvocationTargetException at sun.re ...

  2. Downloadftp

    #!/bin/bash FILENAME=$ DSTDIR=$ FTPSRV=ip FTPUSER="user" FTPPWD="password" SRCDI ...

  3. windows中 git 命令使用记录

    建议国内开发安装淘宝npm镜像cnpm npm install -g cnpm --registry=https://registry.npm.taobao.org 或者每次执行安装时 npm ins ...

  4. C# windows服务:通过cmd命令安装、卸载、启动和停止Windows Service(InstallUtil.exe)

    步骤: 1.运行--〉cmd:打开cmd命令框 2.在命令行里定位到InstallUtil.exe所在的位置 InstallUtil.exe 默认的安装位置是在C:/Windows/Microsoft ...

  5. 学JS的心路历程-正规表达式Regular Expression

    今天我们来看正规表达式,在谈到为什么需要多学这个之前,先来看个示例. 假设需要判断输入字串是否含有“apple”: var text=“A apple a day keeps the doctor a ...

  6. Illegal access: this web application instance has been stopped already. could not load **

    启动tomcat的时候会报这样的错误: Illegal access: this web application instance has been stopped already.  could n ...

  7. 文字在线转图片二维码的公用API接口

    在线生成网址二维码的API接口: 1.百度网盘(可使用https)       http://pan.baidu.com/share/qrcode?w=150&h=150&url=ht ...

  8. JS----事件2

    一 事件对象(event):与特定事件相关且包含有关该事件详细信息的对象 通过事件可以触发event对象的元素,鼠标的位置及状态,按下的键等等event对象只在事件发生的过程中才有效非IE浏览器里的e ...

  9. mui-图文列表 图片大小问题

    下面是源码,不能调节图片大小 <ul class="mui-table-view"> <li class="mui-table-view-cell mu ...

  10. flume 实际的使用

    1.No configuration found for this host:seqGenSrc bin/flume-ng agent --conf conf --conf-file conf/flu ...