jace.tang
2022-06-13 ab94f070d797edbe927d7d58a460cc4eddf48b03
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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 M423project
{
    public partial class FormStartup : Form
    {
        public FormStartup()
        {
            InitializeComponent();
        }
 
        public void  CloseMe(object o, EventArgs e)
        {
            this.Close();
        }
 
        public static void LoadAndRun(Form form)
        {
 
            form.HandleCreated += delegate
            {
                new Thread(new ThreadStart(delegate
                {
                    FormStartup formStartup = new FormStartup();
                    form.Shown += delegate
                    {
                        formStartup.Invoke(new EventHandler(formStartup.CloseMe));
                        formStartup.Dispose();
                                             form.WindowState = FormWindowState.Maximized;
                    };
                    Application.Run(formStartup);
                })).Start();
            };
 
            Application.Run(form);
        }
 
        private void timer1_Tick(object sender, EventArgs e)
        {
            progressBar1.Value++;
        }
    }
}