MsgBoxHelper.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows.Forms;
  7. using DevExpress.XtraEditors;
  8. namespace DxHelper
  9. {
  10. public static class MsgBoxHelper
  11. {
  12. public static void ShowInfo(string msg)
  13. {
  14. XtraMessageBox.Show(msg,"提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  15. }
  16. public static void ShowWarning(string msg)
  17. {
  18. XtraMessageBox.Show(msg, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  19. }
  20. public static void ShowError(string msg)
  21. {
  22. XtraMessageBox.Show(msg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
  23. }
  24. /// <summary>
  25. /// 显示确认消息(是=true,否=false)
  26. /// </summary>
  27. /// <param name="msg"></param>
  28. /// <returns></returns>
  29. public static bool ShowConfirm(string msg)
  30. {
  31. var result = XtraMessageBox.Show(msg, "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
  32. return result == DialogResult.Yes;
  33. }
  34. }
  35. }