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

📄 frmstudentwelcome.cs

📁 本论文叙述了联机考试系统的现状以及C#语言的概况。重点介绍了联机考试系统的实现过程:包括系统分析、 系统调查、 数据流程分析、功能设计、 数据库设计、 系统物理配置方案、 系统实现、 系统测试和调试。
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace OES
{
	/// <summary>
	/// Summary description for frmStudentWelcome.
	/// </summary>
	public class frmStudentWelcome : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label lblWelcomeStudent;
		private System.Windows.Forms.Label lblLogout;
		private System.Windows.Forms.Label lblScheduledExam;
		private System.Windows.Forms.Label lblViewResult;
		public System.Windows.Forms.Button btnViewResults;
		private System.Windows.Forms.Button btnScheduledExam;
		public System.Windows.Forms.Button btnLogout;
		private System.Windows.Forms.Button btnHelp;
		private System.Windows.Forms.Label lblHelp;
		private System.ComponentModel.IContainer components=null;

		static int flag=0;//to keep track of form that is active in the background
		frmViewResult result;
		frmExamSchedule exam;
		private System.Windows.Forms.HelpProvider hlpOES;
		frmLogin objLogin;

		//记录当前登录学生名称
		private string strCurrentStudentName;
		
		public frmStudentWelcome(frmLogin login)
		{

			InitializeComponent();
		
			objLogin = login;
		}
		public frmStudentWelcome(frmLogin login,string strStudentName)
		{

			strCurrentStudentName=strStudentName;
			InitializeComponent();
		
			objLogin = login;
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmStudentWelcome));
			this.lblWelcomeStudent = new System.Windows.Forms.Label();
			this.lblLogout = new System.Windows.Forms.Label();
			this.label6 = new System.Windows.Forms.Label();
			this.lblScheduledExam = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.lblViewResult = new System.Windows.Forms.Label();
			this.btnViewResults = new System.Windows.Forms.Button();
			this.btnScheduledExam = new System.Windows.Forms.Button();
			this.btnLogout = new System.Windows.Forms.Button();
			this.btnHelp = new System.Windows.Forms.Button();
			this.lblHelp = new System.Windows.Forms.Label();
			this.hlpOES = new System.Windows.Forms.HelpProvider();
			this.SuspendLayout();
			// 
			// lblWelcomeStudent
			// 
			this.lblWelcomeStudent.AutoSize = true;
			this.lblWelcomeStudent.BackColor = System.Drawing.Color.Transparent;
			this.lblWelcomeStudent.Font = new System.Drawing.Font("Century Gothic", 27.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.lblWelcomeStudent.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(255)));
			this.lblWelcomeStudent.Location = new System.Drawing.Point(304, 48);
			this.lblWelcomeStudent.Name = "lblWelcomeStudent";
			this.lblWelcomeStudent.Size = new System.Drawing.Size(139, 49);
			this.lblWelcomeStudent.TabIndex = 0;
			this.lblWelcomeStudent.Text = "欢  迎  ";
			this.lblWelcomeStudent.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// lblLogout
			// 
			this.lblLogout.AutoSize = true;
			this.lblLogout.BackColor = System.Drawing.Color.Transparent;
			this.lblLogout.Font = new System.Drawing.Font("Verdana", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.lblLogout.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(255)));
			this.lblLogout.Location = new System.Drawing.Point(216, 360);
			this.lblLogout.Name = "lblLogout";
			this.lblLogout.Size = new System.Drawing.Size(207, 22);
			this.lblLogout.TabIndex = 48;
			this.lblLogout.Text = "要退出系统,请单击“退出”";
			// 
			// label6
			// 
			this.label6.AutoSize = true;
			this.label6.BackColor = System.Drawing.Color.Transparent;
			this.label6.Font = new System.Drawing.Font("Verdana", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label6.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(255)));
			this.label6.Location = new System.Drawing.Point(200, 176);
			this.label6.Name = "label6";
			this.label6.Size = new System.Drawing.Size(0, 22);
			this.label6.TabIndex = 46;
			// 
			// lblScheduledExam
			// 
			this.lblScheduledExam.BackColor = System.Drawing.Color.Transparent;
			this.lblScheduledExam.Font = new System.Drawing.Font("Verdana", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.lblScheduledExam.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(255)));
			this.lblScheduledExam.Location = new System.Drawing.Point(216, 144);
			this.lblScheduledExam.Name = "lblScheduledExam";
			this.lblScheduledExam.Size = new System.Drawing.Size(552, 40);
			this.lblScheduledExam.TabIndex = 45;
			this.lblScheduledExam.Text = "要参加为您安排的考试,请单击本窗口左边的“已安排的考试”";
			// 
			// label2
			// 
			this.label2.AutoSize = true;
			this.label2.BackColor = System.Drawing.Color.Transparent;
			this.label2.Font = new System.Drawing.Font("Verdana", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label2.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(255)));
			this.label2.Location = new System.Drawing.Point(200, 280);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(0, 22);
			this.label2.TabIndex = 43;
			// 
			// lblViewResult
			// 
			this.lblViewResult.BackColor = System.Drawing.Color.Transparent;
			this.lblViewResult.Font = new System.Drawing.Font("Verdana", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.lblViewResult.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(255)));
			this.lblViewResult.Location = new System.Drawing.Point(216, 248);
			this.lblViewResult.Name = "lblViewResult";
			this.lblViewResult.Size = new System.Drawing.Size(560, 40);
			this.lblViewResult.TabIndex = 42;
			this.lblViewResult.Text = "要查看所有此前考试的结果,请单击本窗口左边的“查看结果”";
			// 
			// btnViewResults
			// 
			this.btnViewResults.BackColor = System.Drawing.Color.Transparent;
			this.btnViewResults.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
			this.btnViewResults.Font = new System.Drawing.Font("Verdana", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.btnViewResults.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
			this.btnViewResults.Location = new System.Drawing.Point(8, 261);
			this.btnViewResults.Name = "btnViewResults";
			this.btnViewResults.Size = new System.Drawing.Size(128, 30);
			this.btnViewResults.TabIndex = 50;
			this.btnViewResults.Text = "查看结果( &R)";
			this.btnViewResults.Click += new System.EventHandler(this.btnViewResults_Click);
			// 
			// btnScheduledExam
			// 
			this.btnScheduledExam.AllowDrop = true;
			this.btnScheduledExam.BackColor = System.Drawing.Color.Transparent;
			this.btnScheduledExam.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
			this.btnScheduledExam.Font = new System.Drawing.Font("Verdana", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.btnScheduledExam.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
			this.btnScheduledExam.Location = new System.Drawing.Point(16, 144);
			this.btnScheduledExam.Name = "btnScheduledExam";
			this.btnScheduledExam.Size = new System.Drawing.Size(104, 48);
			this.btnScheduledExam.TabIndex = 51;
			this.btnScheduledExam.Text = "已安排的考试(&E)";
			this.btnScheduledExam.Click += new System.EventHandler(this.btnScheduledExam_Click);
			// 
			// btnLogout
			// 
			this.btnLogout.BackColor = System.Drawing.Color.Transparent;
			this.btnLogout.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
			this.btnLogout.Font = new System.Drawing.Font("Verdana", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.btnLogout.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
			this.btnLogout.Location = new System.Drawing.Point(24, 354);
			this.btnLogout.Name = "btnLogout";
			this.btnLogout.Size = new System.Drawing.Size(88, 30);
			this.btnLogout.TabIndex = 52;
			this.btnLogout.Text = "退出(&O)";
			this.btnLogout.Click += new System.EventHandler(this.btnLogout_Click);
			// 
			// btnHelp
			// 
			this.btnHelp.BackColor = System.Drawing.Color.Transparent;
			this.btnHelp.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
			this.btnHelp.Font = new System.Drawing.Font("Verdana", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.btnHelp.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
			this.btnHelp.Location = new System.Drawing.Point(24, 447);
			this.btnHelp.Name = "btnHelp";
			this.btnHelp.Size = new System.Drawing.Size(88, 30);
			this.btnHelp.TabIndex = 53;
			this.btnHelp.Text = "帮助(&H)";
			this.btnHelp.Click += new System.EventHandler(this.btnHelp_Click);
			// 
			// lblHelp
			// 
			this.lblHelp.AutoSize = true;
			this.lblHelp.BackColor = System.Drawing.Color.Transparent;
			this.lblHelp.Font = new System.Drawing.Font("Verdana", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.lblHelp.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(255)));
			this.lblHelp.Location = new System.Drawing.Point(216, 448);
			this.lblHelp.Name = "lblHelp";
			this.lblHelp.Size = new System.Drawing.Size(241, 22);
			this.lblHelp.TabIndex = 54;
			this.lblHelp.Text = "要获取更多信息,请单击“帮助”";
			// 
			// frmStudentWelcome
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(26, 59);
			this.BackColor = System.Drawing.SystemColors.HighlightText;
			this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
			this.ClientSize = new System.Drawing.Size(812, 536);
			this.Controls.Add(this.lblHelp);
			this.Controls.Add(this.lblLogout);
			this.Controls.Add(this.lblWelcomeStudent);
			this.Controls.Add(this.btnHelp);
			this.Controls.Add(this.btnLogout);
			this.Controls.Add(this.btnScheduledExam);
			this.Controls.Add(this.btnViewResults);
			this.Controls.Add(this.label6);
			this.Controls.Add(this.lblScheduledExam);
			this.Controls.Add(this.label2);
			this.Controls.Add(this.lblViewResult);
			this.Font = new System.Drawing.Font("Century Gothic", 36F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(255)));
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
			this.MaximizeBox = false;
			this.Name = "frmStudentWelcome";
			this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
			this.Text = "frmStudentWelcome";
			this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
			this.Load += new System.EventHandler(this.frmStudentWelcome_Load);
			this.ResumeLayout(false);

		}
		#endregion

		
//		[STAThread]
//		static void Main() 
//		{
//			Application.Run(new frmStudentWelcome());
//		}

		private void btnScheduledExam_Click(object sender, System.EventArgs e)
		{	
			this.btnScheduledExam.ForeColor=Color.Khaki;
			this.btnViewResults.ForeColor=SystemColors.ActiveCaptionText;
			this.btnHelp.ForeColor=SystemColors.ActiveCaptionText;
			//flag check is done to close the other forms that may be open in the background
			if(flag==2)
			{
				result.Close();//close the frmViewResults form if open
			}
			flag=1;//set flag to indicate frmExamSchedule is being called

			exam=new frmExamSchedule(this);//,this.strCurrentStudentName );
			exam.ShowDialog();//modify by dongping 2004-12-25
		}
		
		private void btnViewResults_Click(object sender, System.EventArgs e)
		{
			this.btnScheduledExam.ForeColor=SystemColors.ActiveCaptionText;
			this.btnHelp.ForeColor=SystemColors.ActiveCaptionText;

			this.btnViewResults.ForeColor=Color.Khaki;

			//flag check is done to close the other forms that may be open in the background
			if(flag==1)
			{
				exam.Close();//close the frmExamSchedule form if open
			}
			flag=2;//set flag to indicate frmViewResults is being called
			result =new frmViewResult();
			result.ShowDialog();//modify by dongping 2004-12-25
		}
		
		private void btnLogout_Click(object sender, System.EventArgs e)
		{			
			this.Close();//close the current active form - frmStudentWelcome
			if(flag==1)
			{			
				exam.Close();//close frmExamSchedule if open
			}
			if(flag==2)
			{
				result.Close();//close frmViewResult if open
			}
			objLogin.txtUsername.Text="";
			objLogin.txtPassword.Text="";
			objLogin.Show();//show the existing instance of the objLogin form
			objLogin.txtUsername.Focus();
			objLogin.lblLogin.Text="";
			frmLogin.ctr=1;
		}

		private void btnHelp_Click(object sender, System.EventArgs e)
		{
			this.btnHelp.ForeColor=Color.Khaki;
			this.btnScheduledExam.ForeColor=SystemColors.ActiveCaptionText;
			this.btnViewResults.ForeColor=SystemColors.ActiveCaptionText;
			Help.ShowHelp(this,Environment.CurrentDirectory +@"\\OES_Help\OES_Help.chm");
		}

		private void frmStudentWelcome_Load(object sender, System.EventArgs e)
		{
			this.lblWelcomeStudent.Text="欢  迎  "+this.objLogin.txtUsername.Text;
		}
	}
}

⌨️ 快捷键说明

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