using System.Diagnostics; using System.Windows.Forms; using System.Drawing; using System; class Test { static void Main () { Application.Run (new MyForm ()); } public class MyForm : Form { public MyForm () { Button b = new Button (); b.Click += new EventHandler (b_Click); this.Controls.Add (b); } void b_Click (object sender, EventArgs e) { this.MinimizeBox = !this.MinimizeBox; this.MaximizeBox = !this.MaximizeBox; } } }