如何处理Form.MaximumBox单击

时间:2011-07-29 07:31:39

标签: c# windows winforms forms

大家好! 当用户在窗口中单击maximumBox时,我需要跟踪事件。 有可能吗?

2 个答案:

答案 0 :(得分:5)

试试这个:使用WindowState属性

   private void  Form1_Resize(object sender, EventArgs e)
   {
       if (this.WindowState == FormWindowState.Maximized)
       {
           \\ code to execute after Maximize button has been clicked
           MessageBox.Show(this.WindowState.ToString());

       }
   }

答案 1 :(得分:1)

您可以在resize事件中检查表单的窗口状态。

   private void Form1_Resize(object sender, EventArgs e)

   {



       if (this.WindowState == FormWindowState.Maximized)

       {

           \\ code to execute after Maximize button has been clicked

       }



       if (this.WindowState == FormWindowState.Minimized)

       {

           \\ code to execute after Minimize button has been clicked

       }



   }