MDI窗体应用
2021-05-07 09:27
标签:client private form dip UI image ons str 遍历 1.什么是MDI? 多文档界面 2.如何创建MDI窗体 A.设定当前窗体为MDI父窗体,即将IsMdiContainer属性设为true。 private void TileHorizontalToolStripMenuItem_Click(object sender, EventArgs e) private void ArrangeIconsToolStripMenuItem_Click(object sender, EventArgs e) 5.更改MDI主窗体背景 即修改MdiClient对象的背景,通过遍历MDI窗口的Controls对象集来获得。 MDI窗体应用 标签:client private form dip UI image ons str 遍历 原文地址:http://www.cnblogs.com/slpa/p/7644007.html
Form childForm = new Form();
childForm.MdiParent = this;
childForm.Text = "窗口 " + childFormNumber++;
childForm.Show();
B.在项目上单击鼠标右键,选择“添加窗体”,直接添加MDI父窗体。(它会直接将代码添加好,十分方便)
3.子窗体排列
private void CascadeToolStripMenuItem_Click(object sender, EventArgs e)
{
LayoutMdi(MdiLayout.Cascade); //层叠子窗体
}
private void TileVerticalToolStripMenuItem_Click(object sender, EventArgs e)
{
LayoutMdi(MdiLayout.TileVertical);//垂直平铺子窗体
}
{
LayoutMdi(MdiLayout.TileHorizontal);//水平平铺窗体
}
{
LayoutMdi(MdiLayout.ArrangeIcons);//所有子窗体排列图标方式
}
4.关闭所有子窗体
private void CloseAllToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Form childForm in MdiChildren)
{
childForm.Close();
}
}
下一篇:C# 缓存操作类