不知道为什么,WPF的MeaageBox的风格还停留在Win 2000的风格。。。

 

WPF:完美自定义MeaagseBox 动画 反弹 背景模糊 扁平化

很久前就想自己封装一个MessageBox出来,但是都只是简单的封装,不怎么具有通用性。这次终于搞完了。

使用方法和系统的MessageBox的使用方法相似度90%以上。另外10%主要是自己加进去了一些更实用的东西进去。

好,废话不多说。

MessageBox经常使用的元素有这些:

1.MessageButton:由于方便以后扩展,这里不使用原生的MessageButton枚举,而是自定义一个枚举:

/// <summary>
    /// CMessageBox显示的按钮类型
    /// </summary>
    public enum CMessageBoxButton
    {
        OK = 0,
        OKCancel = 1,
        YesNO = 2,
        YesNoCancel = 3
    }

2.MessageBoxImage,由于方便以后扩展,这里不使用原生的MessageBoxImage枚举,而是自定义一个枚举:

    /// <summary>
    /// CMessageBox显示的图标类型
    /// </summary>
    public enum CMessageBoxImage
    {
        None = 0,
        Error = 1,
        Question = 2,
        Warning = 3
    }
CMessageBoxImage

相关文章:

  • 2022-01-13
  • 2021-08-25
  • 2022-12-23
  • 2022-02-12
  • 2022-12-23
  • 2021-11-08
  • 2021-12-15
猜你喜欢
  • 2022-12-23
  • 2022-01-22
  • 2021-11-16
  • 2021-06-19
  • 2022-12-23
  • 2021-05-06
  • 2021-11-19
相关资源
相似解决方案