【问题标题】:How to handle Form.MaximumBox click如何处理 Form.MaximumBox 点击
【发布时间】:2011-07-29 07:31:38
【问题描述】:

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

【问题讨论】:

    标签: c# windows winforms forms


    【解决方案1】:

    试试这个:利用 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());
    
           }
       }
    

    【讨论】:

      【解决方案2】:

      您可以在 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
      
             }
      
      
      
         }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2019-07-03
        • 2013-01-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-01-28
        相关资源
        最近更新 更多