在Form中:
最小化:
this.WindowState = FormWindowState.Minimized; //最小化
最大化:
this.WindowState = FormWindowState.Maximized;
正常化:
this.WindowState = FormWindowState.Normal;
關閉(窗體):
this.Close();
一個按鈕實現正常化、最大化相互切換:
private void button2_Click(object sender, EventArgs e) { if (this.WindowState == FormWindowState.Maximized) //若最大化 { this.WindowState = FormWindowState.Normal; //則正常化 } else if (this.WindowState == FormWindowState.Normal) //若正常化 { this.WindowState = FormWindowState.Maximized; //則最大化 } }
