• c# winform 欢迎界面时加载数据


    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Threading;
    
    namespace WindowsFormsApplication1
    {
        public partial class WelcomeForm : Form
        {
            public WelcomeForm()
            {
                InitializeComponent();
            }
    
            private void WelcomeForm_Load(object sender, EventArgs e)
            {
                //Thread.Sleep(2000);
                //this.Close();
                //this.Dispose();
            }
    
            public void KillMe(object o, EventArgs e)
            {
                this.Close();
            }
    
            /// <summary>
            /// 加载并显示主窗体
            /// </summary>
            /// <param name="form">主窗体</param>
            public static void LoadAndRun(Form form)
            {
                //订阅主窗体的句柄创建事件
                form.HandleCreated += delegate
                {
                    //启动新线程来显示Splash窗体
                    new Thread(new ThreadStart(delegate
                    {
                        WelcomeForm splash = new WelcomeForm();
                        //订阅主窗体的Shown事件
                        form.Shown += delegate
                        {
                            //通知Splash窗体关闭自身
                            splash.Invoke(new EventHandler(splash.KillMe));
                            splash.Dispose();
                        };
                       // Thread.Sleep(2000);
                        //显示Splash窗体
                        Application.Run(splash);
                    })).Start();
                };
                //显示主窗体
                Application.Run(form);
            }
    
        }
    }
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Threading;
    
    namespace WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                //Thread.Sleep(2000);
                for (int i = 0; i < 100; i++)
                {
                    Thread.Sleep(100);
                }
                //this.Focus();
                MessageBox.Show("加载完毕!");
            }
        }
    }
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Windows.Forms;
    using System.Threading;
    
    namespace WindowsFormsApplication1
    {
        static class Program
        {
            /// <summary>
            /// 应用程序的主入口点。
            /// </summary>
            [STAThread]
            static void Main()
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
    
                WelcomeForm.LoadAndRun(new Form1());
            }
        }
    }
  • 相关阅读:
    wireshark 导出所有filter出来的包
    ubuntu 14.04安装pypcap
    激活windows7 企业版小记
    ubuntu 14.04 以root权限启动chrome
    git clone Linux 源码并切换TAG
    ubuntu 14.04 ns2.35 ***buffer overflow detected **: ns terminated解决办法
    我离baidu.com有几跳
    linux tcp超时重传实现分析
    dpctl 工具使用
    由于log太多导致ubuntu硬盘空间满了,进入不了系统解决办法
  • 原文地址:https://www.cnblogs.com/liuxinls/p/3361511.html
Copyright © 2020-2023  润新知