在项目中加入附件中的DevExpress.Localization.v10.1.dll引用
winform:
webform:
Default.aspx的Page_Load事件中加入以下sources
DevExpress.Web.ASPxClasses.Localization.ASPxperienceLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressWebASPxClassesLocalizationCHS();
DevExpress.Web.ASPxEditors.Localization.ASPxEditorsLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressWebASPxEditorsLocalizationCHS();
DevExpress.Web.ASPxGridView.Localization.ASPxGridViewLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressWebASPxGridViewLocalizationCHS();
DevExpress.Web.ASPxHtmlEditor.Localization.ASPxHtmlEditorLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressWebASPxHtmlEditorLocalizationCHS();
DevExpress.Web.ASPxScheduler.Localization.ASPxSchedulerLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressWebASPxSchedulerLocalizationCHS();
DevExpress.Web.ASPxSpellChecker.Localization.ASPxSpellCheckerLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressWebASPxSpellCheckerLocalizationCHS();
DevExpress.Web.ASPxTreeList.Localization.ASPxTreeListLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressWebASPxTreeListLocalizationCHS();
WPF:
DevExpress.Wpf.Editors.Localization.EditorLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressWpfEditorsLocalizationCHS();
DevExpress.Wpf.Grid.Localization.GridControlLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressWpfGridLocalizationCHS();
DevExpress.Wpf.NavBar.Localization.NavBarLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressWpfNavBarLocalizationCHS();
注:若在项目中没有用到相关控件,则不需要创建类的实例。例如:沒有使用到XtraScheduler控件就不需要
DevExpress.XtraScheduler.Localization.SchedulerLocalizer.Active = new DevExpress.LocalizationCHS.DevExpressXtraSchedulerLocalizationCHS();
以下sources为建立界面风格菜单,打开用户设置的界面风格,语言
DevExpress.FOSOYO.LookAndFeelSettings.Load("FOSOYO.ini");
DevExpress.FOSOYO.LanguageSettings.Load("FOSOYO.ini");
//DevMenu
new DevExpress.FOSOYO.DevExpressLookAndFeelMenu(barManager1, barSubItem1, defaultLookAndFeel1);
//DevRibbonMenu
new DevExpress.FOSOYO.DevExpressRibbonMenu(ribbon, ribbonPageGroup1, defaultLookAndFeel1, true);
//VS2002 2003Menu
new DevExpress.FOSOYO.VS2003LookAndFeelMenu(this, defaultLookAndFeel1, "FOSOYO");
//VS2005 2008Menu
new DevExpress.FOSOYO.VS20052008LookAndFeelMenu(this, PaintStyle);
在FormClosing事件中加入以下Source,保存用户设置的界面风格,语言
DevExpress.FOSOYO.LookAndFeelSettings.Save("FOSOYO.ini");
DevExpress.FOSOYO.LanguageSettings.Save("FOSOYO.ini");
特别强调这里一定用很多人按照上面的步骤后报错,“xxx”中不存在类型或命名空间名称“Localization”(是缺少程序集引用吗?),运行出现了错误和警告。
一般的话一定是关注错误的,但是问题所在是警告如图
看到“目标框架”了吧,其实问题出在这里,一般用vs2010建立程序它都帮你选择了
NET 4 Client Profile这个架构,正因为这个架构是相对NET Framework 4精简,所以导致汉化引用一些东西没有,没有细心看很难发觉这个错误。这个问题解决方法是
项目右键属性进入里面
弄了整晚,都两点多了,洗洗睡觉了,╮(╯▽╰)╭。