1,首先是窗体图片
1.1主窗体
1.2 副窗体(3个一样)
3,主窗体代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MDI
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void 展示子窗体ToolStripMenuItem_Click(object sender, EventArgs e)
{
Form2 form2 = new Form2();
form2.MdiParent = this;
form2.Show();
Form3 form3 = new Form3();
form3.MdiParent = this;
form3.Show();
Form4 form4 = new Form4();
form4.MdiParent = this;
form4.Show();
}
private void 横排显示ToolStripMenuItem_Click(object sender, EventArgs e)
{
LayoutMdi(MdiLayout.TileVertical);
}
private void 竖排显示ToolStripMenuItem_Click(object sender, EventArgs e)
{
LayoutMdi(MdiLayout.TileHorizontal);
}
}
}
4,副窗体(3个一样)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MDI
{
public partial class Form4 : Form
{
public Form4()
{
InitializeComponent();
}
}
}