⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmmain.cs

📁 三层体系结构的应用-学员管理系统 一个学校需要一个学生管理系统。分以下功能: 管理班档案 管理学生档案 学校开了多门课程
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace Student
{
	using Aptech.Student.DataAccess;
	
	/// <summary>
	/// Form1 的摘要说明。
	/// </summary>
	public class frmMain : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Panel pnlLeft;
		private System.Windows.Forms.Panel pnlMain;
		private System.Windows.Forms.Label lblClass;
		private System.Windows.Forms.MainMenu mainMenu1;
		private System.Windows.Forms.MenuItem menuItem1;
		private System.Windows.Forms.MenuItem menuItem2;
		private System.Windows.Forms.MenuItem menuItem3;
		private System.Windows.Forms.MenuItem menuItem4;
		private System.Windows.Forms.ImageList imageList1;
		private System.Windows.Forms.ListView lstClass;
		private System.Windows.Forms.Label lblStudentInfo;
		private System.Windows.Forms.ListView lstStudent;
		private System.Windows.Forms.Label lblCourse;
		private System.Windows.Forms.ListView lstCourse;
		private System.Windows.Forms.MenuItem menuItem6;
		private System.Windows.Forms.MenuItem menuItem5;
		private System.Windows.Forms.StatusBar statusBar1;
		private System.Windows.Forms.StatusBarPanel statusBarPanel1;
		private System.Windows.Forms.StatusBarPanel statusBarPanel2;
		private System.Windows.Forms.MenuItem menuItem7;
		private System.Windows.Forms.MenuItem menuItem8;
		private System.Windows.Forms.Label lblScore;
		private System.Windows.Forms.DataGrid dataGrid1;
		private System.ComponentModel.IContainer components;

		private int	m_iCurrentRow = -1;	
		private float m_fCurrentScore = -1;


		public frmMain()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// 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.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmMain));
			this.pnlLeft = new System.Windows.Forms.Panel();
			this.lstCourse = new System.Windows.Forms.ListView();
			this.imageList1 = new System.Windows.Forms.ImageList(this.components);
			this.lblCourse = new System.Windows.Forms.Label();
			this.lstClass = new System.Windows.Forms.ListView();
			this.lblClass = new System.Windows.Forms.Label();
			this.pnlMain = new System.Windows.Forms.Panel();
			this.dataGrid1 = new System.Windows.Forms.DataGrid();
			this.lblScore = new System.Windows.Forms.Label();
			this.statusBar1 = new System.Windows.Forms.StatusBar();
			this.statusBarPanel1 = new System.Windows.Forms.StatusBarPanel();
			this.statusBarPanel2 = new System.Windows.Forms.StatusBarPanel();
			this.lstStudent = new System.Windows.Forms.ListView();
			this.lblStudentInfo = new System.Windows.Forms.Label();
			this.mainMenu1 = new System.Windows.Forms.MainMenu();
			this.menuItem1 = new System.Windows.Forms.MenuItem();
			this.menuItem5 = new System.Windows.Forms.MenuItem();
			this.menuItem6 = new System.Windows.Forms.MenuItem();
			this.menuItem7 = new System.Windows.Forms.MenuItem();
			this.menuItem8 = new System.Windows.Forms.MenuItem();
			this.menuItem2 = new System.Windows.Forms.MenuItem();
			this.menuItem3 = new System.Windows.Forms.MenuItem();
			this.menuItem4 = new System.Windows.Forms.MenuItem();
			this.pnlLeft.SuspendLayout();
			this.pnlMain.SuspendLayout();
			((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).BeginInit();
			this.SuspendLayout();
			// 
			// pnlLeft
			// 
			this.pnlLeft.BackColor = System.Drawing.SystemColors.InactiveCaptionText;
			this.pnlLeft.Controls.Add(this.lstCourse);
			this.pnlLeft.Controls.Add(this.lblCourse);
			this.pnlLeft.Controls.Add(this.lstClass);
			this.pnlLeft.Controls.Add(this.lblClass);
			this.pnlLeft.Dock = System.Windows.Forms.DockStyle.Left;
			this.pnlLeft.Location = new System.Drawing.Point(0, 0);
			this.pnlLeft.Name = "pnlLeft";
			this.pnlLeft.Size = new System.Drawing.Size(160, 446);
			this.pnlLeft.TabIndex = 0;
			// 
			// lstCourse
			// 
			this.lstCourse.BackColor = System.Drawing.SystemColors.Control;
			this.lstCourse.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.lstCourse.Dock = System.Windows.Forms.DockStyle.Fill;
			this.lstCourse.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
			this.lstCourse.LargeImageList = this.imageList1;
			this.lstCourse.Location = new System.Drawing.Point(0, 278);
			this.lstCourse.Name = "lstCourse";
			this.lstCourse.Size = new System.Drawing.Size(160, 168);
			this.lstCourse.SmallImageList = this.imageList1;
			this.lstCourse.TabIndex = 5;
			this.lstCourse.View = System.Windows.Forms.View.List;
			this.lstCourse.DoubleClick += new System.EventHandler(this.lstCourse_DoubleClick);
			this.lstCourse.SelectedIndexChanged += new System.EventHandler(this.lstCourse_SelectedIndexChanged);
			// 
			// imageList1
			// 
			this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth24Bit;
			this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
			this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
			this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
			// 
			// lblCourse
			// 
			this.lblCourse.BackColor = System.Drawing.SystemColors.ActiveCaption;
			this.lblCourse.Dock = System.Windows.Forms.DockStyle.Top;
			this.lblCourse.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.lblCourse.ForeColor = System.Drawing.SystemColors.ControlLightLight;
			this.lblCourse.Location = new System.Drawing.Point(0, 255);
			this.lblCourse.Name = "lblCourse";
			this.lblCourse.Size = new System.Drawing.Size(160, 23);
			this.lblCourse.TabIndex = 4;
			this.lblCourse.Text = "课程信息";
			this.lblCourse.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// lstClass
			// 
			this.lstClass.BackColor = System.Drawing.SystemColors.Control;
			this.lstClass.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.lstClass.Dock = System.Windows.Forms.DockStyle.Top;
			this.lstClass.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
			this.lstClass.LargeImageList = this.imageList1;
			this.lstClass.Location = new System.Drawing.Point(0, 22);
			this.lstClass.Name = "lstClass";
			this.lstClass.Size = new System.Drawing.Size(160, 233);
			this.lstClass.SmallImageList = this.imageList1;
			this.lstClass.TabIndex = 2;
			this.lstClass.View = System.Windows.Forms.View.Details;
			this.lstClass.Click += new System.EventHandler(this.lstClass_Click);
			this.lstClass.DoubleClick += new System.EventHandler(this.lstClass_DoubleClick);
			// 
			// lblClass
			// 
			this.lblClass.BackColor = System.Drawing.SystemColors.Highlight;
			this.lblClass.Dock = System.Windows.Forms.DockStyle.Top;
			this.lblClass.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.lblClass.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
			this.lblClass.Location = new System.Drawing.Point(0, 0);
			this.lblClass.Name = "lblClass";
			this.lblClass.Size = new System.Drawing.Size(160, 22);
			this.lblClass.TabIndex = 0;
			this.lblClass.Text = "班列表";
			this.lblClass.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// pnlMain
			// 
			this.pnlMain.BackColor = System.Drawing.SystemColors.Menu;
			this.pnlMain.Controls.Add(this.dataGrid1);
			this.pnlMain.Controls.Add(this.lblScore);
			this.pnlMain.Controls.Add(this.statusBar1);
			this.pnlMain.Controls.Add(this.lstStudent);
			this.pnlMain.Controls.Add(this.lblStudentInfo);
			this.pnlMain.Dock = System.Windows.Forms.DockStyle.Fill;
			this.pnlMain.Location = new System.Drawing.Point(160, 0);
			this.pnlMain.Name = "pnlMain";
			this.pnlMain.Size = new System.Drawing.Size(472, 446);
			this.pnlMain.TabIndex = 1;
			// 
			// dataGrid1
			// 
			this.dataGrid1.CaptionText = "成绩信息";
			this.dataGrid1.CaptionVisible = false;
			this.dataGrid1.DataMember = "";
			this.dataGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
			this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
			this.dataGrid1.Location = new System.Drawing.Point(0, 278);
			this.dataGrid1.Name = "dataGrid1";
			this.dataGrid1.RowHeadersVisible = false;
			this.dataGrid1.Size = new System.Drawing.Size(472, 146);
			this.dataGrid1.TabIndex = 11;
			this.dataGrid1.Navigate += new System.Windows.Forms.NavigateEventHandler(this.dataGrid1_Navigate);
			this.dataGrid1.CurrentCellChanged += new System.EventHandler(this.dataGrid1_CurrentCellChanged);
			this.dataGrid1.MouseLeave += new System.EventHandler(this.dataGrid1_MouseLeave);
			// 
			// lblScore
			// 
			this.lblScore.BackColor = System.Drawing.SystemColors.Highlight;
			this.lblScore.Dock = System.Windows.Forms.DockStyle.Top;
			this.lblScore.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.lblScore.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
			this.lblScore.Location = new System.Drawing.Point(0, 255);
			this.lblScore.Name = "lblScore";
			this.lblScore.Size = new System.Drawing.Size(472, 23);
			this.lblScore.TabIndex = 9;
			this.lblScore.Text = "成绩信息";
			this.lblScore.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// statusBar1
			// 
			this.statusBar1.Location = new System.Drawing.Point(0, 424);
			this.statusBar1.Name = "statusBar1";
			this.statusBar1.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
																						  this.statusBarPanel1,
																						  this.statusBarPanel2});
			this.statusBar1.Size = new System.Drawing.Size(472, 22);
			this.statusBar1.TabIndex = 8;
			// 
			// statusBarPanel1
			// 
			this.statusBarPanel1.Text = "statusBarPanel1";
			// 
			// statusBarPanel2
			// 
			this.statusBarPanel2.Text = "statusBarPanel2";
			// 
			// lstStudent
			// 
			this.lstStudent.AllowColumnReorder = true;
			this.lstStudent.Dock = System.Windows.Forms.DockStyle.Top;
			this.lstStudent.FullRowSelect = true;
			this.lstStudent.GridLines = true;
			this.lstStudent.HideSelection = false;
			this.lstStudent.HoverSelection = true;
			this.lstStudent.LargeImageList = this.imageList1;
			this.lstStudent.Location = new System.Drawing.Point(0, 22);
			this.lstStudent.Name = "lstStudent";
			this.lstStudent.Size = new System.Drawing.Size(472, 233);
			this.lstStudent.SmallImageList = this.imageList1;
			this.lstStudent.TabIndex = 4;
			this.lstStudent.View = System.Windows.Forms.View.Details;
			this.lstStudent.DoubleClick += new System.EventHandler(this.lstStudent_DoubleClick);
			this.lstStudent.SelectedIndexChanged += new System.EventHandler(this.lstStudent_SelectedIndexChanged);
			// 
			// lblStudentInfo
			// 
			this.lblStudentInfo.BackColor = System.Drawing.SystemColors.Highlight;
			this.lblStudentInfo.Dock = System.Windows.Forms.DockStyle.Top;
			this.lblStudentInfo.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.lblStudentInfo.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
			this.lblStudentInfo.Location = new System.Drawing.Point(0, 0);
			this.lblStudentInfo.Name = "lblStudentInfo";
			this.lblStudentInfo.Size = new System.Drawing.Size(472, 22);
			this.lblStudentInfo.TabIndex = 3;
			this.lblStudentInfo.Text = "学生信息";
			this.lblStudentInfo.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// mainMenu1
			// 
			this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.menuItem1,
																					  this.menuItem3,
																					  this.menuItem4});
			this.mainMenu1.RightToLeft = System.Windows.Forms.RightToLeft.No;
			// 
			// menuItem1
			// 
			this.menuItem1.Index = 0;
			this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.menuItem5,
																					  this.menuItem6,
																					  this.menuItem7,
																					  this.menuItem8,
																					  this.menuItem2});
			this.menuItem1.Text = "文件";
			// 
			// menuItem5
			// 
			this.menuItem5.Index = 0;
			this.menuItem5.Text = "新建班级(&C)";
			this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click);
			// 
			// menuItem6
			// 
			this.menuItem6.Index = 1;
			this.menuItem6.Text = "新建学生档案(&N)";
			this.menuItem6.Click += new System.EventHandler(this.menuItem6_Click);
			// 
			// menuItem7
			// 
			this.menuItem7.Index = 2;
			this.menuItem7.Text = "科目管理(&S)";
			this.menuItem7.Click += new System.EventHandler(this.menuItem7_Click);
			// 
			// menuItem8
			// 
			this.menuItem8.Index = 3;
			this.menuItem8.Text = "建立课程(&R)";
			this.menuItem8.Click += new System.EventHandler(this.menuItem8_Click);
			// 
			// menuItem2
			// 
			this.menuItem2.Index = 4;
			this.menuItem2.Text = "退出(&Q)";
			this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
			// 
			// menuItem3
			// 
			this.menuItem3.Index = 1;
			this.menuItem3.Text = "视图";
			// 
			// menuItem4
			// 
			this.menuItem4.Index = 2;
			this.menuItem4.Text = "帮助";
			// 
			// frmMain
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(632, 446);
			this.Controls.Add(this.pnlMain);
			this.Controls.Add(this.pnlLeft);
			this.Menu = this.mainMenu1;
			this.Name = "frmMain";
			this.Text = "学员管理系统";
			this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
			this.Load += new System.EventHandler(this.frmMain_Load);
			this.pnlLeft.ResumeLayout(false);
			this.pnlMain.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// 应用程序的主入口点。
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new frmMain());
		}

		private void frmMain_Load(object sender, System.EventArgs e)
		{
			GetClass();
			CreateStudentTemp();
			GetStudent();
			CreateScoreTemp();
			GetScore();
			CreateCourseTemp();

		
		}

		private void GetClass()
		{
			lstClass.Items.Clear();
			this.statusBar1.Panels[1].Text = "正在获取班级信息...";
			Classs classs = new Classs();
			DataSet dataSet = new DataSet();
			try
			{
				dataSet = classs.SelectClass(
					-1,
					"");
			}
			catch(Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
			ColumnHeader columnHeader = new ColumnHeader();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -