winform Splash加載窗口

static ApplicationContext context;
        /// <summary>
        /// 應用程序的主入口點。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Splash sp = new Splash();
            sp.Show();
            context = new ApplicationContext();
            context.Tag = sp;
            Application.Idle += new EventHandler(Application_idle);
            Application.Run(context);

           // Application.Run(new Form1());
        }

        private static void Application_idle(object sender,EventArgs e)
        {
            Application.Idle -= new EventHandler(Application_idle);
            if (context.MainForm == null)
            {
                Form1 f1 = new Form1();
                context.MainForm = f1;
                f1.Init();
                Splash sp = (Splash)context.Tag;
                sp.Close();
                f1.Show();

            }
        }

 

 

背景透明:

 

 this.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(192)), ((System.Byte)(192)));

            this.TransparencyKey = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(192)), ((System.Byte)(192)));  

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章