developer express右键菜单显示汉化
本文转载:http://www.cnblogs.com/xuhaibiao/archive/2011/10/26/2225694.html
首先建一个cn.cs文件,内容为:
using System;
using DevExpress.XtraEditors.Controls;
using DevExpress.XtraGrid.Localization;
namespace UI
{
public class ChineseLocalizer : Localizer
{
public override string Language { get { return "Chinese"; } }
// overriding the GetLocalizedString method
public override string GetLocalizedString(StringId id)
{
switch (id)
{
// ...
case StringId.TextEditMenuCut: return "剪切";
case StringId.TextEditMenuCopy: return "复制";
case StringId.TextEditMenuPaste: return "粘贴";
case StringId.TextEditMenuDelete: return "删除";
case StringId.TextEditMenuUndo: return "撤销";
case StringId.TextEditMenuSelectAll: return "全选";
case StringId.CheckChecked: return "是";
case StringId.CheckUnchecked: return "否";
case StringId.LookUpEditValueIsNull: return "请选择";
// ...
}
return "";
}
}
}
然后在你的Program.cs中的main函数里加入
//DevExpress控件本地化
DevExpress.XtraEditors.Controls.Localizer.Active = new UI.ChineseLocalizer();
using System;
using DevExpress.XtraEditors.Controls;
using DevExpress.XtraGrid.Localization;
namespace UI
{
public class ChineseLocalizer : Localizer
{
public override string Language { get { return "Chinese"; } }
// overriding the GetLocalizedString method
public override string GetLocalizedString(StringId id)
{
switch (id)
{
// ...
case StringId.TextEditMenuCut: return "剪切";
case StringId.TextEditMenuCopy: return "复制";
case StringId.TextEditMenuPaste: return "粘贴";
case StringId.TextEditMenuDelete: return "删除";
case StringId.TextEditMenuUndo: return "撤销";
case StringId.TextEditMenuSelectAll: return "全选";
case StringId.CheckChecked: return "是";
case StringId.CheckUnchecked: return "否";
case StringId.LookUpEditValueIsNull: return "请选择";
// ...
}
return "";
}
}
}
然后在你的Program.cs中的main函数里加入
//DevExpress控件本地化
DevExpress.XtraEditors.Controls.Localizer.Active = new UI.ChineseLocalizer();
作者:阿笨
【官方QQ一群:跟着阿笨一起玩NET(已满)】:422315558
【官方QQ二群:跟着阿笨一起玩C#(已满)】:574187616
【官方QQ三群:跟着阿笨一起玩ASP.NET(已满)】:967920586
【官方QQ四群:Asp.Net Core跨平台技术开发(可加入)】:829227829
【官方QQ五群:.NET Core跨平台开发技术(可加入)】:647639415
【网易云课堂】:https://study.163.com/provider/2544628/index.htm?share=2&shareId=2544628
【腾讯课堂】:https://abennet.ke.qq.com
【51CTO学院】:https://edu.51cto.com/sd/66c64
【微信公众号】:微信搜索:跟着阿笨一起玩NET