• 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,
        }
    
     
  • 相关阅读:
    艾伟:WinForm控件开发总结(三)认识WinForm控件常用的Attribute 狼人:
    break while(1)
    从“不太差”到“卓越”
    分享一种需求评审的方案
    高德地图 android api 实现自动定位
    Java Class Loader解析
    JAVA IO 设计模式彻底分析
    [latex]PGF 和 tikz中如何旋转图形的示例
    算法笔记之 并查集入门 POJ 1611
    Vector 和 ArrayList 哪一个更好? 为什么?
  • 原文地址:https://www.cnblogs.com/badaoliumangqizhi/p/11510611.html
Copyright © 2020-2023  润新知