📄 mdiform.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
namespace 课程安排
{
public partial class MDIForm : Form
{
private ClassUI classUI;
private TeacherUI teacherUI;
private SubjectUI subjectUI;
private CourseUI courseUI;
public MDIForm()
{
InitializeComponent();
School.ReadFromDB();
DBFileOper.CreateBackDB();
School.ReadProperties();
// School.Term = "07-08年度下学期";
}
protected override void OnClosing(CancelEventArgs e)
{
School.WriteProperties();
DBFileOper.DeleteBackDB();
base.OnClosing(e);
}
private void 教师信息ToolStripMenuItem_Click(object sender, EventArgs e)
{
teacherUI = null;
foreach (object obj in this.MdiChildren)
{
if (obj is TeacherUI)
{
teacherUI = obj as TeacherUI;
(obj as TeacherUI).Show();
(obj as TeacherUI).Focus();
}
}
if (teacherUI == null)
{
this.teacherUI = new TeacherUI();
this.teacherUI.MdiParent = this;
this.teacherUI.Show();
this.teacherUI.Focus();
}
}
private void 班级信息ToolStripMenuItem_Click(object sender, EventArgs e)
{
classUI = null;
foreach (object obj in this.MdiChildren)
{
if (obj is ClassUI)
{
classUI = obj as ClassUI;
(obj as ClassUI).Show();
(obj as ClassUI).Focus();
}
}
if (classUI == null)
{
this.classUI = new ClassUI();
this.classUI.MdiParent = this;
this.classUI.Show();
this.classUI.Focus();
}
}
private void 科目信息ToolStripMenuItem_Click(object sender, EventArgs e)
{
subjectUI = null;
foreach (object obj in this.MdiChildren)
{
if (obj is SubjectUI)
{
subjectUI = obj as SubjectUI;
(obj as SubjectUI).Show();
(obj as SubjectUI).Focus();
}
}
if (subjectUI == null)
{
this.subjectUI = new SubjectUI();
this.subjectUI.MdiParent = this;
this.subjectUI.Show();
this.subjectUI.Focus();
}
}
private void 课程表编排ToolStripMenuItem_Click(object sender, EventArgs e)
{
courseUI = null;
foreach (object obj in this.MdiChildren)
{
if (obj is CourseUI)
{
courseUI = obj as CourseUI;
(obj as CourseUI).Show();
(obj as CourseUI).Focus();
}
}
if (courseUI == null)
{
this.courseUI = new CourseUI();
this.courseUI.MdiParent = this;
this.courseUI.Show();
this.courseUI.Focus();
}
}
private void 打印ToolStripMenuItem_Click(object sender, EventArgs e)
{
frmPrint fp = new frmPrint();
fp.ShowDialog();
}
private void 保存到数据库ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (School.WriteToDB())
{
MessageBox.Show("数据保存成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("数据保存失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void 重新载入数据ToolStripMenuItem_Click(object sender, EventArgs e)
{
School.ReadFromDB();
}
private void 帮助ToolStripMenuItem_Click(object sender, EventArgs e)
{
string name = AppDomain.CurrentDomain.BaseDirectory + "//帮助.chm";
Process.Start(name);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -