C#使窗体无法改变大小只能最大化最小化显示的方法

来源:互联网 发布:阿里云搭建smtp服务器 编辑:程序博客网 时间:2024/05/15 23:47

   protected override void WndProc(ref Message m)         {             if (m.Msg == WM_SYSCOMMAND )             {                 if (m.WParam.ToInt32() == SC_RESTORE)                 {                     if (this.WindowState != FormWindowState.Minimized)                         return;                 }                             }              if (m.Msg == WM_NCLBUTTONDBLCLK)              {                 return;             }                   base.WndProc (ref m);         }                  public const int  WM_NCLBUTTONDBLCLK              =0x00A3;         public const int WM_SYSCOMMAND = 0x0112;         public const int SC_RESTORE  =    0xF120; 

在窗体中重写消息处理方法