DevExpressの中の英語のヒントを修正して、英語を中国語に変えます
10537 ワード
1:DXプロンプトボックスの英字を変更する
1 /// <summary>
2 /// DX
3 /// </summary>
4 public class CHS : DevExpress.XtraEditors.Controls.Localizer
5 {
6 public override string GetLocalizedString(DevExpress.XtraEditors.Controls.StringId id)
7 {
8 switch (id)
9 {
10 case DevExpress.XtraEditors.Controls.StringId.XtraMessageBoxYesButtonText:
11 return " ";
12 case DevExpress.XtraEditors.Controls.StringId.XtraMessageBoxCancelButtonText:
13 return " ";
14 case DevExpress.XtraEditors.Controls.StringId.XtraMessageBoxOkButtonText:
15 return " ";
16 case DevExpress.XtraEditors.Controls.StringId.XtraMessageBoxNoButtonText:
17 return " ";
18 }
19 return base.GetLocalizedString(id);
20 }
21 }
他のヒントを変更する場合は、「追加」を選択します.
2:GridControlのFind Clearまたはその他の英字文字を中国語に置き換える.
/// <summary>
/// DX
/// </summary>
public class BuilderGridLocalizer : GridLocalizer
{
Dictionary<GridStringId, string> CusLocalizedkeyValue = null;
public BuilderGridLocalizer(Dictionary<GridStringId,string> cusLocalizedKeyValues)
{
this.CusLocalizedkeyValue = cusLocalizedKeyValues;
}
public override string GetLocalizedString(GridStringId id)
{
if(CusLocalizedkeyValue != null)
{
string gridStringDisplay = string.Empty;
foreach (var gridLocalizer in CusLocalizedkeyValue)
{
if(gridLocalizer.Key.Equals(id))
{
gridStringDisplay = gridLocalizer.Value;
break;
}
}
return gridStringDisplay;
}
return base.GetLocalizedString(id);
}
}
1 /// <summary>
2 /// DX
3 /// </summary>
4 public static Dictionary<GridStringId, string> SetGridLocalizer(GridStringId[] grid, params string[] str)
5 {
6 Dictionary<GridStringId, string> LocalizedKeyValue = new Dictionary<GridStringId, string>();
7
8 for (int i = 0; i < str.Count(); i++)
9 {
10 LocalizedKeyValue.Add(grid[i], str[i]);
11 }
12 return LocalizedKeyValue;
13 }
呼び出し:
1 public class BaseForm : RibbonForm
2 {
3 /// <summary>
4 /// GridControl
5 /// </summary>
6 public BaseForm()
7 {
8 GridStringId[] gridString = { GridStringId.FindControlFindButton, GridStringId.FindControlClearButton };
9 string[] dxName = { " ", " " };
10 BuilderGridLocalizer builder = new BuilderGridLocalizer(DXControl.SetGridLocalizer(gridString, dxName));
11 GridLocalizer.Active = builder;
12 }
13
14
15 }