const int WM_SYSCOMMAND = 0x112;
        const int SC_CLOSE = 0xF060;
        const int SC_MINIMIZE = 0xF020;
        const int SC_MAXIMIZE = 0xF030;
        protected override void WndProc(ref Message m)
        {
          if (m.Msg == WM_SYSCOMMAND)
          {
            if (m.WParam.ToInt32() == SC_MINIMIZE) //是否点击最小化
            {
              //这里写操作代码
              this.Visible = false; //隐藏窗体
              return;
            }
            if (m.WParam.ToInt32() == SC_MAXIMIZE ) //是否点击最大化
            {
               //.....................
            }
            if (m.WParam.ToInt32() == SC_CLOSE) //是否点击关闭
            {
              //关闭时发生的事件
            }
          }
          base.WndProc(ref m);
        }

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-03
猜你喜欢
  • 2021-09-27
  • 2021-05-23
  • 2021-10-31
  • 2022-12-23
  • 2021-06-07
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案