• DevExpress如何实现皮肤的添加及本地化


    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);
            }
     
             
        }
    }
  • 相关阅读:
    python常用包收集
    python pep 8
    常用python字符串处理
    安全资源整理
    WordPress下载安装简单配置实例
    PHP框架学习之Laravel基本功能
    PHP框架学习之Laravel安装
    PHP面试题之优化
    PHP面试题之小杂鱼
    PHP面试题之文件目录操作
  • 原文地址:https://www.cnblogs.com/zuochanzi/p/8143747.html
Copyright © 2020-2023  润新知