需要定义一个继承子Localizer的类,然后重写GetLocalizedString
public class MessboxClass : Localizer
{
public override string GetLocalizedString(DevExpress.XtraEditors.Controls.StringId id)
{
switch (id)
{
case StringId.XtraMessageBoxCancelButtonText:
return "取消";
case StringId.XtraMessageBoxOkButtonText:
return "确定";
case StringId.XtraMessageBoxYesButtonText:
return "是";
case StringId.XtraMessageBoxNoButtonText:
return "否";
case StringId.XtraMessageBoxIgnoreButtonText:
return "忽略";
case StringId.XtraMessageBoxAbortButtonText:
return "中止";
case StringId.XtraMessageBoxRetryButtonText:
return "重试";
default:
return base.GetLocalizedString(id);
}
}
}
最后要在系统的Program.cs的Main函数中使用如下一句:
DevExpress.XtraEditors.Controls.Localizer.Active = new MessboxClass();