彩票走势图

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

原创|其它|编辑:郝浩|2012-10-17 13:45:02.000|阅读 4439 次

概述:DevExpress.XtraBars.Helpers.SkinHelper类允许您填充现有RibbonGalleryBarItem或任意菜单(PopupMenu或BarSubItem)项目对应的DevExpress皮肤。

# 慧都年终大促·界面/图表报表/文档/IDE等千款热门软控件火热促销中 >>

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

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

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);
        }

        
    }
} 
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports DevExpress.XtraBars.Ribbon
Imports DevExpress.XtraBars.Helpers

Namespace HowToUseBarSkinHelper
    Partial Public Class Form1
        Inherits RibbonForm
        Public Sub New()
            InitializeComponent()
        End Sub

        Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
            SkinHelper.InitSkinGallery(ribbonGalleryBarItem1, True)
            SkinHelper.InitSkinPopupMenu(popupMenu1)
        End Sub
    End Class
End Namespace


标签:DevExpress

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@pclwef.cn

文章转载自:慧都控件网

为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP