原本的窗体:using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;namespace 知识竞赛答题系统
{
/// <summary>
/// AddGeneral 的摘要说明。
/// </summary>
public class AddGeneral : System.Windows.Forms.Form
{
         protected LogicTier.Logic Operation=new LogicTier.Logic(); private System.Windows.Forms.PictureBox pictureBox1;
protected System.Windows.Forms.GroupBox groupBox1;
protected System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label1;
protected System.Windows.Forms.TextBox textBox2;
protected System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label7;
protected System.Windows.Forms.TextBox textBox4;
protected System.Windows.Forms.TextBox textBox5;
protected System.Windows.Forms.TextBox textBox6;
protected System.Windows.Forms.TextBox textBox7;
protected System.Windows.Forms.TextBox textBox8;
private System.Windows.Forms.Label label8;
protected System.Windows.Forms.TextBox textBox9;
private System.Windows.Forms.Label label9;
protected System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
protected System.Windows.Forms.Label label10;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null; public AddGeneral()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent(); //
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
} /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
} protected virtual void button1_Click(object sender, System.EventArgs e)
{
                  内容省略了..
} private void button2_Click(object sender, System.EventArgs e)
{
this.Close();
} private void textBox1_Enter(object sender, System.EventArgs e)
{
         label10.Visible=false;
}
}
}
继承的窗体using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;namespace 知识竞赛答题系统
{
/// <summary>
/// AddGroup 的摘要说明。
/// </summary>
public class AddGroup:AddGeneral
{
private System.Windows.Forms.TextBox textBox10;

public AddGroup()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
          using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;namespace 知识竞赛答题系统
{
/// <summary>
/// AddGroup 的摘要说明。
/// </summary>
public class AddGroup:AddGeneral
{
private System.Windows.Forms.TextBox textBox10;

public AddGroup()
{
//
// TODO: 在此处添加构造函数逻辑
//
} private void InitializeComponent()
{
this.textBox10 = new System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
// 
// groupBox1
// 
this.groupBox1.Name = "groupBox1";
// 
// textBox1
// 
this.textBox1.Name = "textBox1";
// 
// textBox2
// 
this.textBox2.Name = "textBox2";
// 
// textBox3
// 
this.textBox3.Name = "textBox3";
// 
// textBox4
// 
this.textBox4.Name = "textBox4";
// 
// textBox5
// 
this.textBox5.Name = "textBox5";
// 
// textBox6
// 
this.textBox6.Name = "textBox6";
// 
// textBox7
// 
this.textBox7.Name = "textBox7";
// 
// textBox8
// 
this.textBox8.Name = "textBox8";
// 
// textBox9
// 
this.textBox9.Name = "textBox9";
// 
// button1
// 
this.button1.Name = "button1";
// 
// label10
// 
this.label10.Name = "label10";
// 
// textBox10
// 
this.textBox10.Location = new System.Drawing.Point(320, 296);
this.textBox10.Name = "textBox10";
this.textBox10.TabIndex = 5;
this.textBox10.Text = "textBox10";
// 
// AddGroup
// 
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(624, 336);
this.Controls.Add(this.textBox10);
this.Name = "AddGroup";
this.Controls.SetChildIndex(this.textBox10, 0);
this.Controls.SetChildIndex(this.groupBox1, 0);
this.Controls.SetChildIndex(this.button1, 0);
this.Controls.SetChildIndex(this.label10, 0);
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false); } protected override void button1_Click(object sender, System.EventArgs e)后面是函数体部分了..跟问题没关我就没写了怕大虾们看了太多不看了.我只是在继承的窗体里面拖放了个textBox10,但是
private void menuItem3_Click(object sender, System.EventArgs e)
{
AddGeneral frm=new AddGeneral();
frm.MdiParent=this;
frm.Show();
} private void menuItem5_Click(object sender, System.EventArgs e)
{
AddGroup frm=new AddGroup();
    frm.MdiParent=this;
frm.Show();
}这两个函数NEW出来的窗口一样的...请问是什么原因呀?

解决方案 »

  1.   

    this.ClientSize = new System.Drawing.Size(624, 336);
    在这个后面加以下语句试试
    this.Controls.AddRange(new System.Windows.Forms.Control[]{this.textBox10});
      

  2.   

    sunou5() 兄.
    this.Controls.AddRange(new System.Windows.Forms.Control[]{this.textBox10});写了还是没用.
      

  3.   

    this.textBox10.Location = new System.Drawing.Point(320, 296);设置完位置之后,为何没设置其size?
      

  4.   


    this.Controls.Add(this.textBox10);
    改成
    base.Controls.Add( this.textBox10 );然后再试试
      

  5.   

    sunou5() 
    this.textBox10.Location = new System.Drawing.Point(320, 296);设置完位置之后,为何没设置其size?大侠.自动添加的.