📄 mainfrm.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace StudentManagementsystem
{
/// <summary>
/// MainFrm 的摘要说明。
/// </summary>
public class MainFrm : System.Windows.Forms.Form
{
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem menuItem2;
private System.Windows.Forms.MenuItem menuItem7;
private System.Windows.Forms.StatusBar MainstatusBar;
private System.Windows.Forms.MainMenu StuMenu;
private System.Windows.Forms.MenuItem Newstu;
private System.Windows.Forms.MenuItem QueryStu;
private System.Windows.Forms.MenuItem InputGrade;
private System.Windows.Forms.MenuItem QueryStuGrade;
private System.Windows.Forms.MenuItem UpdateRole;
private System.Windows.Forms.MenuItem ExitSys;
private System.Windows.Forms.MenuItem UpdateStu;
private System.Windows.Forms.MenuItem AddClass;
private System.Windows.Forms.MenuItem ChgPsw;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.MenuItem Addcour;
private System.Windows.Forms.MenuItem SysHlp;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public MainFrm()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
this.MainFrm_Load();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.StuMenu = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.Newstu = new System.Windows.Forms.MenuItem();
this.QueryStu = new System.Windows.Forms.MenuItem();
this.UpdateStu = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.InputGrade = new System.Windows.Forms.MenuItem();
this.QueryStuGrade = new System.Windows.Forms.MenuItem();
this.menuItem7 = new System.Windows.Forms.MenuItem();
this.UpdateRole = new System.Windows.Forms.MenuItem();
this.ChgPsw = new System.Windows.Forms.MenuItem();
this.AddClass = new System.Windows.Forms.MenuItem();
this.Addcour = new System.Windows.Forms.MenuItem();
this.ExitSys = new System.Windows.Forms.MenuItem();
this.SysHlp = new System.Windows.Forms.MenuItem();
this.MainstatusBar = new System.Windows.Forms.StatusBar();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.SuspendLayout();
//
// StuMenu
//
this.StuMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1,
this.menuItem2,
this.menuItem7,
this.ExitSys,
this.SysHlp});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.Newstu,
this.QueryStu,
this.UpdateStu});
this.menuItem1.Text = "学生信息管理";
//
// Newstu
//
this.Newstu.Index = 0;
this.Newstu.Text = "新生信息录入";
this.Newstu.Click += new System.EventHandler(this.Newstu_Click);
//
// QueryStu
//
this.QueryStu.Index = 1;
this.QueryStu.Text = "学生信息查询";
this.QueryStu.Click += new System.EventHandler(this.QueryStu_Click);
//
// UpdateStu
//
this.UpdateStu.Index = 2;
this.UpdateStu.Text = "更新学生信息";
this.UpdateStu.Click += new System.EventHandler(this.UpdateStu_Click);
//
// menuItem2
//
this.menuItem2.Index = 1;
this.menuItem2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.InputGrade,
this.QueryStuGrade});
this.menuItem2.Text = "学生成绩管理";
//
// InputGrade
//
this.InputGrade.Index = 0;
this.InputGrade.Text = "学生成绩录入";
this.InputGrade.Click += new System.EventHandler(this.InputGrade_Click);
//
// QueryStuGrade
//
this.QueryStuGrade.Index = 1;
this.QueryStuGrade.Text = "学生成绩查询";
this.QueryStuGrade.Click += new System.EventHandler(this.QueryStuGrade_Click);
//
// menuItem7
//
this.menuItem7.Index = 2;
this.menuItem7.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.UpdateRole,
this.ChgPsw,
this.AddClass,
this.Addcour});
this.menuItem7.Text = "系统维护";
//
// UpdateRole
//
this.UpdateRole.Index = 0;
this.UpdateRole.Text = "权限管理";
this.UpdateRole.Click += new System.EventHandler(this.UpdateRole_Click);
//
// ChgPsw
//
this.ChgPsw.Index = 1;
this.ChgPsw.Text = "密码修改";
this.ChgPsw.Click += new System.EventHandler(this.ChgPsw_Click);
//
// AddClass
//
this.AddClass.Index = 2;
this.AddClass.Text = "班级管理";
this.AddClass.Click += new System.EventHandler(this.AddClass_Click);
//
// Addcour
//
this.Addcour.Index = 3;
this.Addcour.Text = "课程管理";
this.Addcour.Click += new System.EventHandler(this.Addcour_Click);
//
// ExitSys
//
this.ExitSys.Index = 3;
this.ExitSys.Text = "退出系统";
this.ExitSys.Click += new System.EventHandler(this.ExitSys_Click);
//
// SysHlp
//
this.SysHlp.Index = 4;
this.SysHlp.Text = "帮助信息";
this.SysHlp.Click += new System.EventHandler(this.SysHlp_Click);
//
// MainstatusBar
//
this.MainstatusBar.Location = new System.Drawing.Point(0, 381);
this.MainstatusBar.Name = "MainstatusBar";
this.MainstatusBar.Size = new System.Drawing.Size(600, 16);
this.MainstatusBar.TabIndex = 0;
this.MainstatusBar.Text = "学生信息管理系统";
//
// pictureBox1
//
this.pictureBox1.BackColor = System.Drawing.SystemColors.ControlDark;
this.pictureBox1.Location = new System.Drawing.Point(0, 0);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(600, 376);
this.pictureBox1.TabIndex = 1;
this.pictureBox1.TabStop = false;
//
// MainFrm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(600, 397);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.MainstatusBar);
this.Menu = this.StuMenu;
this.Name = "MainFrm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "MainFrm";
this.ResumeLayout(false);
}
#endregion
static void Main()
{
Login log=new Login();
log.ShowDialog();
if(Login.loginOrnot==true) Application.Run(new MainFrm());
}
//根据登陆的用户名设置窗体状态。
private void MainFrm_Load()
{
this.MainstatusBar.Text="欢迎使用学生信息管理系统:"+Login.Username;
}
//-----------显示学生信息查询窗体---------
private void QueryStu_Click(object sender, System.EventArgs e)
{
QueryStu QryStu=new QueryStu();
QryStu.Show();
}
//-----------显示更新学生信息窗体---------
private void UpdateStu_Click(object sender, System.EventArgs e)
{
UpdateStu updstu=new UpdateStu();
updstu.Show();
}
//-----------显示学生成绩录入窗体---------
private void InputGrade_Click(object sender, System.EventArgs e)
{
InputGrade inptgrade=new InputGrade();
inptgrade.Show();
}
//-----------显示学生成绩查询窗体---------
private void QueryStuGrade_Click(object sender, System.EventArgs e)
{
QueryStuGrade qrystu=new QueryStuGrade();
qrystu.Show();
}
//-----------显示权限管理窗体---------
private void UpdateRole_Click(object sender, System.EventArgs e)
{
UpdateRole updrole=new UpdateRole();
updrole.Show();
}
//-----------显示新生信息录入窗体---------
private void Newstu_Click(object sender, System.EventArgs e)
{
NewStu nfrm=new NewStu();
nfrm.Show();
}
//-----------退出主界面---------
private void ExitSys_Click(object sender, System.EventArgs e)
{
if(MessageBox.Show("您确认要退出本系统?","确认",MessageBoxButtons.YesNoCancel)==DialogResult.Yes)
this.Close();
}
//-----------显示密码修改窗体---------
private void ChgPsw_Click(object sender, System.EventArgs e)
{
ChgPsw ChangePsw=new ChgPsw();
ChangePsw.Show();
}
//-----------显示班级管理窗体---------
private void AddClass_Click(object sender, System.EventArgs e)
{
NewClass NewC=new NewClass();
NewC.Show();
}
//-----------显示课程管理窗体---------
private void Addcour_Click(object sender, System.EventArgs e)
{
AddCourse AdCour=new AddCourse();
AdCour.Show();
}
//-----------显示帮助窗体---------
private void SysHlp_Click(object sender, System.EventArgs e)
{
SysHelp hp=new SysHelp();
hp.Show();
}
private void Stu_JC_Click(object sender, System.EventArgs e)
{
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -