有点晕.
不知道是不是这个意思
新建一个form上面放一个button
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.IsMdiContainer = true;
}
private void button1_Click(object sender, EventArgs e)
{
Form f = new Form();
f.Width = 100;
f.Height = 100;
f.MdiParent = this;
Button btn = new Button();
btn.Text = "showf1";
btn.Click += new EventHandler(btn_Click);
f.Controls.Add(btn);
f.Show();
}
void btn_Click(object sender, EventArgs e)
{
Form f1 = new Form();
f1.MdiParent = this;
f1.Width = 100;
f1.Height = 200;
f1.Show();
}
}
}