彩票走势图

DXperience WinForms12.2帮助文档八:本地化XtraGrid控件

原创|其它|编辑:郝浩|2013-01-30 10:52:59.000|阅读 635 次

概述:本示例展示了如何在 DXperience WinForms 12.2中将XtraGrid控件的界面本地化为德语。

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

相关链接:

下面这个例子展示了如何在 DXperience WinForms Subscription中将XtraGrid控件的界面本地化为德语。要实现本地化,首先要创建DevExpress.XtraGrid.Localization.GridLocalizer和Localizer类子节点,然后通过改变默认的资源字符串实现XtraGrid控件的本地化。

本地化示例代码:

public class GermanGridLocalizer : GridLocalizer {
   public override string Language { get { return "Deutsch"; }}
   public override string GetLocalizedString(GridStringId id) {
      string ret = "";
      switch(id) {
         // ... 
         case GridStringId.MenuColumnSortAscending : return "Aufsteigend sortieren"; 
         case GridStringId.MenuColumnSortDescending : return "Absteigend sortieren"; 
         case GridStringId.MenuColumnGroup : return "Gruppieren fur dieses Feld"; 
         case GridStringId.MenuColumnUnGroup : return "Gruppierung aufheben"; 
         case GridStringId.MenuColumnColumnCustomization : 
             return "Laufzeit benutzerdefinierte Spalte"; 
         case GridStringId.MenuColumnBestFit : return "Optimale Breite"; 
         case GridStringId.MenuColumnFilter : return "Kann gruppieren"; 
         case GridStringId.MenuColumnClearFilter : return "Filter aufheben"; 
         case GridStringId.MenuColumnBestFitAllColumns : return "Optimale Breite (alle Spalten)";
         // ... 
         default:
            ret = "";
            break;
      }
      return ret;
   }
}

public class GermanEditorsLocalizer : Localizer {
   public override string Language { get { return "Deutsch"; }}
   public override string GetLocalizedString(StringId id) {
      switch(id) {
         // ... 
         case StringId.NavigatorTextStringFormat: return "Zeile {0} von {1}";
         case StringId.PictureEditMenuCut: return "Ausschneiden";
         case StringId.PictureEditMenuCopy: return "Kopieren";
         case StringId.PictureEditMenuPaste: return "Einfugen";
         case StringId.PictureEditMenuDelete: return "Loschen";
         case StringId.PictureEditMenuLoad: return "Laden";
         case StringId.PictureEditMenuSave: return "Speichern";
         // ... 
      }
      return "";
   }
}

这样本地化资源就被实例化,并将它们部署到父节点的Active属性:

 private void Form1_Load(object sender, System.EventArgs e) {
   GridLocalizer.Active = new GermanGridLocalizer();
   Localizer.Active = new GermanEditorsLocalizer();
}

运行时的XtraGrid界面本地化效果:

DXperience,XtraGrid,本地化效果


标签:

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

文章转载自:慧都控件

为你推荐

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


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP