zoukankan      html  css  js  c++  java
  • DevExpress的对话框XtraMessageBox的使用

    场景

    在Winform中一般弹出对话框使用的是MessageBox,而在

    DevExpress中使用的是XtraMessageBox实现对话框。

    效果

    实现

    首先新建确认按钮的调用方法:

    public DialogResult Confirm(string strString)
            {
                return DevExpress.XtraEditors.XtraMessageBox.Show(strString, "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
            }

    然后在调用的地方

    if (isWriteX == true && isWriteY == true)
                {
                    if (this.Confirm("保存成功") == DialogResult.OK)
                        this.Dispose();
                }
                else
                {
                    DevExpress.XtraEditors.XtraMessageBox.Show("保存失败", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                }

    其中DialogResult.OK就是点击确定后的效果,点击确定后将窗体关闭。

    其他效果:

    public enum DialogResult
        {
            // 摘要: 
            //     从对话框返回了 Nothing。这表明有模式对话框继续运行。
            None = 0,
            //
            // 摘要: 
            //     对话框的返回值是 OK(通常从标签为“确定”的按钮发送)。
            OK = 1,
            //
            // 摘要: 
            //     对话框的返回值是 Cancel(通常从标签为“取消”的按钮发送)。
            Cancel = 2,
            //
            // 摘要: 
            //     对话框的返回值是 Abort(通常从标签为“中止”的按钮发送)。
            Abort = 3,
            //
            // 摘要: 
            //     对话框的返回值是 Retry(通常从标签为“重试”的按钮发送)。
            Retry = 4,
            //
            // 摘要: 
            //     对话框的返回值是 Ignore(通常从标签为“忽略”的按钮发送)。
            Ignore = 5,
            //
            // 摘要: 
            //     对话框的返回值是 Yes(通常从标签为“是”的按钮发送)。
            Yes = 6,
            //
            // 摘要: 
            //     对话框的返回值是 No(通常从标签为“否”的按钮发送)。
            No = 7,
        }
    
     
  • 相关阅读:
    Ubuntu 只能用guest登录的问题修复
    Ubuntu下编译C语言程序(同时给编译生成的文件命名)
    设置PYTHONIOENCODING
    Ubuntu安装atom
    R语言中将数据框(data.frame)中字符型数据转化为数值型
    修改记事本默认编码为UTF-8
    Java虚拟机浅探
    制作宅基腐主页 && 制作个人简历--材料:BootStrap
    尝试用有限状态机解决一道算法题
    OOP,WEB开发实用小技巧
  • 原文地址:https://www.cnblogs.com/badaoliumangqizhi/p/11510611.html
Copyright © 2011-2022 走看看