实现目标,固定窗体大小,1.窗体标题去掉最大化按钮2.双击窗体标题也不会最大化,彻底取消最大化问题,如果设置窗体MaximizeBox和MinimumSize属性,看似问题解决了,单随之而来的问题是,双击窗体标题的时候虽然没有改变大小,窗体位置却跳到了左上角,解决方案一:
1 private void frmFixeSize_Load(object sender, EventArgs e) 2 { 3 //方法一 4 this.MaximizeBox = false; 5 this.MinimumSize = this.MaximumSize = this.Size; 6 this.FormBorderStyle = FormBorderStyle.FixedSingle; 7 }
解决方案二:(仍需设置窗体MaximizeBox=false),
MaximizeBox=false
protected override void WndProc(ref Message m) { //方法二 if (m.Msg == 0xa3) { return; } base.WndProc(ref m); }
本实例源代码下载:http://pan.baidu.com/s/1mgKEaXM 密码:lfjf