this.Resize += new System.EventHandler(this.Form1_Resize);
private void Form1_Resize(object sender, System.EventArgs e)
{
if( this.WindowState == System.Windows.Forms.FormWindowState.Minimized )
{
MessageBox.Show("最小化");
}
}

解决方案 »

  1.   

    捕捉Resize事件,然后判断WindowState
      

  2.   

    很感谢各位大侠的回答,但我要的不是这个答案。
    我说的是在protected override void WndProc(ref Message m)
    里面捕捉
    请看protected override void WndProc(ref Message m)
    {const int WM_SYSCOMMAND = 0x0112;
    const int SC_CLOSE = 0xF060;
    if (m.Msg == WM_SYSCOMMAND && (int) m.WParam == SC_CLOSE)
    {
    // User clicked close button
    this.WindowState = FormWindowState.Minimized;
    return;
    }
    base.WndProc(ref m);
    }
    这里面是点击“X”或“Alt+F4”时,最小化窗口
    要怎么才能点击“_”关闭窗口,或最大化窗口呢?
    也就是说SC_MINIMIZE和SC_MAXSIZER值为多少?
    我只贴了一部分,如果看不懂可去http://www.cnblogs.com/doyle/articles/60345.html
      

  3.   

    SC_MINIMIZE     0xF020
     SC_MAXIMIZE     0xF030enjoy