1.需要添加对Microsoft.VisualBasic 引用,

2.准备frmMain,frmSplash两个窗口

 说明:
        frmSplash在主线程上建立,但是在独立线程上进行消息循环
        当protected override void OnCreateMainForm  方法执行完毕,会隐藏frmSplash
        可以在OnCreateMainForm中执行预加载操作,或者在frmMain的构造里执行,不要在frmMain的OnLoad事件中进行
        当需要改边frmSplash窗体上控件属性时(如显示加载提示等)需要使用控件的Invoke

 

using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace SplashLoader
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main(String[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            new SplashApp().Run(args);
        }
    }
}
View Code

相关文章:

  • 2022-12-23
  • 2021-05-28
  • 2021-05-15
  • 2021-12-21
  • 2021-09-17
  • 2021-10-08
  • 2021-09-16
猜你喜欢
  • 2022-12-23
  • 2021-12-22
  • 2021-07-03
  • 2022-12-23
  • 2022-02-22
  • 2022-12-23
相关资源
相似解决方案