DevExpress的提示框

时间:2021-09-05 01:37:20
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DevExpress.XtraEditors;
using System.Windows.Forms; namespace ZL.Shell桌面.Dialog
{
class DialogBox
{
/// <summary>
/// 显示信息
/// </summary>
/// <param name="strSting"></param>
public static void Show(string strSting)
{
DevExpress.XtraEditors.XtraMessageBox.Show(strSting, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
} /// <summary>
/// 确定或取消
/// </summary>
/// <param name="strString"></param>
/// <returns></returns>
public static DialogResult Confirm(string strString)
{
return DevExpress.XtraEditors.XtraMessageBox.Show(strString, "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
} /// <summary>
/// 确定删除
/// </summary>
/// <returns></returns>
public static DialogResult ConfirmDelete()
{
return DevExpress.XtraEditors.XtraMessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
} }
}

汉化ok和cnacel:

using System;
using System.Collections.Generic;
using System.Text;
using DevExpress.XtraEditors.Controls; namespace TrueLore.GGZYZXJG.MainUI.Dialog
{
/// <summary>
/// DialogBox按钮汉化
/// </summary>
public class LocalCHS:Localizer
{
public override string GetLocalizedString(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 "";
}
}
}
}

//调用:

if (DialogBox.Confirm("是否开始设置")==DialogResult.OK) { } else { }