c# c# 从零到精通-定义一个form界面 并调用其他form界面

c# c# 从零到精通-定义一个form界面 并调用其他form界面
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Test01
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
DialogResult dr = MessageBox.Show(“是否关闭窗体”, “提示”, MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (dr == DialogResult.Yes)
{
e.Cancel = false;
}
else
{
e.Cancel = true;
}
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Test02
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void 水平平铺ToolStripMenuItem_Click(object sender, EventArgs e)
{
LayoutMdi(MdiLayout.TileHorizontal);
}

private void 垂直平铺ToolStripMenuItem_Click(object sender, EventArgs e)
{
LayoutMdi(MdiLayout.TileVertical);
}

private void 层叠排列ToolStripMenuItem_Click(object sender, EventArgs e)
{
LayoutMdi(MdiLayout.Cascade);
}

private void Form1_Load(object sender, EventArgs e)
{

    }

private void 加载子窗体ToolStripMenuItem_Click(object sender, EventArgs e)
{
Form2 frm2 = new Form2();
frm2.MdiParent = this;
frm2.Show();
Form3 frm3 = new Form3();
frm3.MdiParent = this;
frm3.Show();
Form4 frm4 = new Form4();
frm4.MdiParent = this;
frm4.Show();
}
}
}

你可能感兴趣的:(c#,开发语言)