developer express右键菜单显示汉化

首先建一个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();

posted @ 2011-10-26 21:22  许海彪  阅读(728)  评论(1编辑  收藏  举报