1 protected override void WndProc(ref Message m) 2 { 3 if (m.Msg==0x112) 4 { 5 switch ((int) m.WParam) 6 { 7 //禁止双击标题栏关闭窗体 8 case 0xF063: 9 case 0xF093: 10 m.WParam = IntPtr.Zero; 11 break; 12 13 //禁止拖拽标题栏还原窗体 14 case 0xF012: 15 case 0xF010: 16 m.WParam = IntPtr.Zero; 17 break; 18 19 //禁止双击标题栏 20 case 0xf122: 21 m.WParam = IntPtr.Zero; 22 break; 23 24 //禁止关闭按钮 25 case 0xF060: 26 m.WParam = IntPtr.Zero; 27 break; 28 29 //禁止最大化按钮 30 case 0xf020: 31 m.WParam = IntPtr.Zero; 32 break; 33 34 //禁止最小化按钮 35 case 0xf030: 36 m.WParam = IntPtr.Zero; 37 break; 38 39 //禁止还原按钮 40 case 0xf120: 41 m.WParam = IntPtr.Zero; 42 break; 43 } 44 } 45 base.WndProc(ref m); 46 }