做个程序  要求是 开启就是最大的化的。。固定不可变。
固然我就把 WindowState 设置成 Maximized  ====启动 最大化实现。
为了窗体固定不可变, 属性 MaximizeBox 设置成false本以为 这样就不会改变大小了 。可是 当双击 窗体上边框的时候 还是缩小了。后来发现 有可能是Size的原因。
就手动改了下 设置成窗体大小。1024 768 OK基本实现 ,可是我的任务栏被覆盖了。。
如果 桌面分辨率 不是1024*768 的时候。就不可以了问下有没有好的方法?来实现 固定不可变呢?

解决方案 »

  1.   

    你只要把maxsize和minsize设置成一样的就行了.
      

  2.   

    vs2005里的属性:
    maxinumsize
    mininumsizeSize------>这个是你窗体的大小.把maxinumsize和mininumsize设置成和size一样的值即可/
      

  3.   

       protected override void WndProc(ref Message m)
            {
                if (m.Msg == 0x0112)  //系统消息 
                {
                    switch (m.WParam.ToInt32())
                    {                 
                        case (int)61490:
                            return;                          
                    }
                }
                base.WndProc(ref m);
            }         private void Form2_Load(object sender, EventArgs e)
            {
                this.Location = new Point(0, 0);            this.Size = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);        }这样看看.
      

  4.   

    错了   private void Form2_Load(object sender, EventArgs e)
            {
                this.Location = new Point(0, 0);            this.Size = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
                this.TopMost = true;
            }
      

  5.   

    this.Size = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); 
    这条语句是用来窗体不覆盖任务栏的,而且多任何显示器,任何分辨率都适用,我刚用了
      

  6.   

    this.maxsize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); this.minsize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); 
    这2条放在构造函数里面,或form_load里面应该就ok.
      

  7.   

    protected override void WndProc(ref Message m)
            {            const int WM_NCLBUTTONDBLCLK = 0xA3;
                switch (m.Msg)
                {
                    case WM_NCLBUTTONDBLCLK://禁止双击最大化                    
                            return;                   
                        break;                default:
                        
                        base.WndProc(ref m);
                        break;
                }
            }   
    *****************************************************************************
    欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码) http://feiyun0112.cnblogs.com/
      

  8.   

      this.Size = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); 
      

  9.   

    你应该设置Form的BoderStyle
      

  10.   

    写一下窗体的onsizechange事件试一下看吧。
      

  11.   

    或者formBorderStyle=fixedSingle 
      

  12.   

    看了下基本上都是 怎么改size, Max and Min.但是我要的是固定的窗体。虽然大小和桌面一样了。。 但是鼠标拖拉 上边框 是能拖动的。
    正常的最大化 是不可以拖动的。
    所以我认为: 应该不用理睬 MAX 和 MIN 的值。
    直接把windowstatus 设置成 Maximized.只有这样才是我想要的最大化的效果。
    唯一的毛病 就是 双击上边框 窗体会变一次 
    问题简单化就是要求:在最大化的前提下双击上边框失效就可以了。7楼的回答 可能就是解决双击问题可是我没看懂SORRY。
      

  13.   

    晕,你把代码放到form里看看不就知道啦
      

  14.   

    7楼的意思呢,就是接管窗口的鼠标双击消息,收到这个消息的时候什么都不干,直接return。