效果描述:
有三個表單然後順序分別是
(1)點擊第一個表單中的按鈕彈出第二個表單,隱藏第一個表單
(2)第二個表單到一定時間彈出第三個表單
(3)點擊第三個表單的按鈕關閉第三個和第二個表單,彈出第一個表單
From1
複製代碼 代碼如下:using System;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void 開啟form2隱藏form1_Click(object sender, EventArgs e)
{
Form2 f = new Form2();
f.fatherForm = this;
f.Show();
this.Hide();
}
}
}
Form2
複製代碼 代碼如下:using System;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
public Form1 fatherForm;
private void 開啟from3_Click(object sender, EventArgs e)
{
Form3 f = new Form3();
f.fatherForm = this;
f.Show();
}
}
}
Form3
複製代碼 代碼如下:using System;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
}
public Form2 fatherForm;
private void 關閉form3from2顯示from1_Click(object sender, EventArgs e)
{
fatherForm.fatherForm.Show();
fatherForm.Close();
this.Close();
}
}
}