override Form的WndProc,将如下代码拷贝到Form类的代码中。protected override void WndProc(ref Message m )
{
const int SC_MINIMIZE = 0xF020;
const int SC_MAXIMIZE = 0xF030;
const int SC_CLOSE = 0xF060; switch (m.WParam.ToInt32())
{
case SC_MAXIMIZE :
{
m.Result = new IntPtr(0); 
this.Size = new Size(600,400);
break;
} case SC_MINIMIZE:
{
m.Result = new IntPtr(0);
this.Size = new Size(300,200);
break;
}
case 0xF060:
{
m.Result = new IntPtr(0);
this.WindowState = FormWindowState.Minimized;
break;
}
default:
{
base.WndProc(ref m);
break;
}
} }