本帖最后由 liubococoa 于 2010-08-21 07:22:04 编辑

解决方案 »

  1.   

    使用 Anchor 属性设置,不用自己去计算。
      

  2.   

    你没理解我的意思,Anchor我写了,只是没有粘出来而以。
    我是说象下面这样来写代码,控件右侧和下侧会被窗体的边框遮挡住一点点;而且在XP与Win7中遮挡的多少还稍有不同。this.ComboBox1.Location = new System.Drawing.Point(152, 733);
    this.ComboBox1.Width = this.Width;
    this.ComboBox1.Height = this.Height;
    this.ComboBox1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
      

  3.   

    Anchor如果设置成四边的话,应该会使控件随Form大小变化而自动变化,不需要再手动设置大小。
      

  4.   

    另外,this.ComboBox1.Width = this.Width;这样肯定会使控件的大小超过Form内部可用大小,Form内部可用大小可从ClientSize属性获得。
      

  5.   

                this.comboBox1.Location = new System.Drawing.Point(this.ClientSize.Width - comboBox1.Width, this.ClientSize.Height-comboBox1.Height);
                //this.comboBox1.Width = this.ClientSize.Width;
                //this.comboBox1.Height = this.ClientSize.Height;
                this.comboBox1.Anchor =  AnchorStyles.Bottom | AnchorStyles.Right;