一、需求:在不同的exe程序中,提示消息框样式一致,内容不同。

 

二、实现:

  1、提示消息框program.cs

static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            frmMsgBox frmMB = new frmMsgBox();
            try
            {
                switch (args.Count())
                {
                    case 3:
                        frmMB.time = Convert.ToInt32(args[2]);
                        frmMB.SaveName = args[1];
                        frmMB.Type = args[0];
                        break;
                    case 2:
                        frmMB.SaveName = args[1];
                        frmMB.Type = args[0];
                        break;
                    case 1:
                        frmMB.Type = args[0];
                        break;
                    case 0:
                        break;
                    default:
                        frmMB.content = args[3];
                        frmMB.time = Convert.ToInt32(args[2]);
                        frmMB.SaveName = args[1];
                        frmMB.Type = args[0];
                        break;
                }
            }
            catch(Exception ex)
            {
                frmMB.Type = string.Empty;
                frmMB.SaveName = string.Empty;
                frmMB.time = 2000;
            }
            Application.Run(frmMB);
        }
    }
View Code

相关文章:

  • 2021-07-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-01
  • 2021-11-03
  • 2021-07-14
  • 2021-11-09
  • 2021-11-18
相关资源
相似解决方案