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,
        }

    本文来自博客园,作者:云辰,转载请注明原文链接:https://www.cnblogs.com/yunchen/p/13753979.html

  • 相关阅读:
    Gridview linkbutton click
    Linux Bluetooth编程 HCI层编程
    Google Android 开发工程师职位面试题
    Android下文件操作模式(含SDCard的读写)
    Android中悬浮窗口的实现原理和示例代码
    Android.mk的用法和基础
    Android.mk的用法和基础
    Linux Bluetooth编程 HCI层编程
    Android下文件操作模式(含SDCard的读写)
    init.rc 脚本语法学习
  • 原文地址:https://www.cnblogs.com/yunchen/p/13753979.html
Copyright © 2011-2022 走看看