大家好,欢迎来到IT知识分享网。
一、运行效果
点击窗口1按钮
点击窗口2按钮
点击窗口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 lianxi20200304
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.IsMdiContainer = true; //设置窗体为父窗体
}
Form2 form2 = new Form2();
Form3 form3 = new Form3();
Form4 form4 = new Form4();
//窗口1显示
private void button1_Click(object sender, EventArgs e)
{
form2.MdiParent = this;
form2.Parent = splitContainer1.Panel2; //form2的parent是panel2
form2.Show();
form3.Hide();
form4.Hide();
}
//窗口2显示
private void button2_Click(object sender, EventArgs e)
{
form3.MdiParent = this;
form3.Parent = splitContainer1.Panel2;
form3.Show();
form2.Hide();
form4.Hide();
}
//窗口3显示
private void button3_Click(object sender, EventArgs e)
{
form4.MdiParent = this;
form4.Parent = splitContainer1.Panel2;
form4.Show();
form2.Hide();
form3.Hide();
}
//水平排列
private void button4_Click(object sender, EventArgs e)
{
LayoutMdi(MdiLayout.TileHorizontal);
}
}
}
免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/20678.html