You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
112 lines
3.8 KiB
112 lines
3.8 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace ControlSystem
|
|
{
|
|
public partial class MDIMain : Form
|
|
{
|
|
private int childFormNumber = 0;
|
|
|
|
public MDIMain()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void ShowNewForm(object sender, EventArgs e)
|
|
{
|
|
// 创建此子窗体的一个新实例。
|
|
Form childForm = new Form();
|
|
// 在显示该窗体前使其成为此 MDI 窗体的子窗体。
|
|
childForm.MdiParent = this;
|
|
childForm.Text = "窗口" + childFormNumber++;
|
|
childForm.Show();
|
|
}
|
|
|
|
private void OpenFile(object sender, EventArgs e)
|
|
{
|
|
OpenFileDialog openFileDialog = new OpenFileDialog();
|
|
openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
|
|
openFileDialog.Filter = "文本文件(*.txt)|*.txt|所有文件(*.*)|*.*";
|
|
if (openFileDialog.ShowDialog(this) == DialogResult.OK)
|
|
{
|
|
string FileName = openFileDialog.FileName;
|
|
// TODO: 在此处添加打开文件的代码。
|
|
}
|
|
}
|
|
|
|
private void SaveAsToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
SaveFileDialog saveFileDialog = new SaveFileDialog();
|
|
saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
|
|
saveFileDialog.Filter = "文本文件(*.txt)|*.txt|所有文件(*.*)|*.*";
|
|
if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
|
|
{
|
|
string FileName = saveFileDialog.FileName;
|
|
// TODO: 在此处添加代码,将窗体的当前内容保存到一个文件中。
|
|
}
|
|
}
|
|
|
|
private void ExitToolsStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
Application.Exit();
|
|
}
|
|
|
|
private void CutToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
// TODO: 使用 System.Windows.Forms.Clipboard 将所选的文本或图像插入到剪贴板
|
|
}
|
|
|
|
private void CopyToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
// TODO: 使用 System.Windows.Forms.Clipboard 将所选的文本或图像插入到剪贴板
|
|
}
|
|
|
|
private void PasteToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
// TODO: 使用 System.Windows.Forms.Clipboard.GetText() 或 System.Windows.Forms.GetData 从剪贴板中检索信息。
|
|
}
|
|
|
|
private void ToolBarToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
toolStrip.Visible = toolBarToolStripMenuItem.Checked;
|
|
}
|
|
|
|
private void StatusBarToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
statusStrip.Visible = statusBarToolStripMenuItem.Checked;
|
|
}
|
|
|
|
private void CascadeToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
LayoutMdi(MdiLayout.Cascade);
|
|
}
|
|
|
|
private void TileVerticleToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
LayoutMdi(MdiLayout.TileVertical);
|
|
}
|
|
|
|
private void TileHorizontalToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
LayoutMdi(MdiLayout.TileHorizontal);
|
|
}
|
|
|
|
private void ArrangeIconsToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
LayoutMdi(MdiLayout.ArrangeIcons);
|
|
}
|
|
|
|
private void CloseAllToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
foreach (Form childForm in MdiChildren)
|
|
{
|
|
childForm.Close();
|
|
}
|
|
}
|
|
}
|
|
}
|