导航

DevExpress的提示框

Posted on 2017-10-27 14:40  清浅ヾ  阅读(1957)  评论(0编辑  收藏  举报
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 { }