Now Loading.........
程式載入這個sample還滿常見的
其實只是在form1前新增另個frm_start
讓它過幾秒後消失即可
像下圖:
--------------------------------------------------------------------------------------------------------------------------
首先先新增windows form取名:frm_start
private void Form1_Load(object sender, EventArgs e)
{
Frm_Start frm = new Frm_Start(); //實體化Form2視窗物件
frm.StartPosition = FormStartPosition.CenterScreen; //設定視窗居中顯示
frm.ShowDialog(); //顯示Form2視窗
}
frm_start如下:
private void Frm_Start_Load(object sender, EventArgs e)
{
this.FormBorderStyle = FormBorderStyle.None; //把視窗其他按鈕拿掉
this.BackgroundImage = Image.FromFile("start.jpg"); //載入start.jpg放在:demo\bin\Debug下
this.BackgroundImageLayout = ImageLayout.Stretch; //填滿圖片
this.timer1.Start(); //啟動計時器
this.timer1.Interval = 5000; //過5秒消失
}
private void timer1_Tick(object sender, EventArgs e)
{
this.Close(); //時間到關閉視窗
}
private void Frm_Start_FormClosed(object sender, FormClosedEventArgs e)
{
this.timer1.Stop(); //關閉計時器
}
沒有留言:
張貼留言