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

📄 selectexam.cs

📁 网络考试系统 系统基于 .NET 框架开发
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace ExamSystem
{
	/// <summary>
	/// SelectExam 的摘要说明。
	/// </summary>
	public class SelectExam : System.Windows.Forms.Form
	{
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.Label label1;
		public System.Windows.Forms.ComboBox fenType;
		public System.Windows.Forms.Label label2;
		private System.Windows.Forms.Button button2;
		private System.Windows.Forms.Label label3;
		private System.ComponentModel.IContainer components;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.Label label6;
		public System.Windows.Forms.TextBox examC;
		private System.Windows.Forms.Timer timer;
		public System.Windows.Forms.ComboBox examC_;

		private MainForm main;
		public  bool actionS = false;

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

			this.main = main;
			//this.fenType.SelectedIndex = 0;
		}

		/// <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(SelectExam));
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.examC_ = new System.Windows.Forms.ComboBox();
			this.label6 = new System.Windows.Forms.Label();
			this.examC = new System.Windows.Forms.TextBox();
			this.label5 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.fenType = new System.Windows.Forms.ComboBox();
			this.label1 = new System.Windows.Forms.Label();
			this.button2 = new System.Windows.Forms.Button();
			this.timer = new System.Windows.Forms.Timer(this.components);
			this.groupBox1.SuspendLayout();
			this.SuspendLayout();
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.examC_);
			this.groupBox1.Controls.Add(this.label6);
			this.groupBox1.Controls.Add(this.examC);
			this.groupBox1.Controls.Add(this.label5);
			this.groupBox1.Controls.Add(this.label3);
			this.groupBox1.Controls.Add(this.label2);
			this.groupBox1.Controls.Add(this.fenType);
			this.groupBox1.Controls.Add(this.label1);
			this.groupBox1.Location = new System.Drawing.Point(8, 8);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(544, 168);
			this.groupBox1.TabIndex = 0;
			this.groupBox1.TabStop = false;
			// 
			// examC_
			// 
			this.examC_.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.examC_.Enabled = false;
			this.examC_.Location = new System.Drawing.Point(72, 136);
			this.examC_.Name = "examC_";
			this.examC_.Size = new System.Drawing.Size(176, 20);
			this.examC_.TabIndex = 9;
			this.examC_.SelectedIndexChanged += new System.EventHandler(this.examC__SelectedIndexChanged);
			// 
			// label6
			// 
			this.label6.Location = new System.Drawing.Point(200, 56);
			this.label6.Name = "label6";
			this.label6.Size = new System.Drawing.Size(32, 16);
			this.label6.TabIndex = 8;
			this.label6.Text = "道";
			// 
			// examC
			// 
			this.examC.Enabled = false;
			this.examC.Location = new System.Drawing.Point(72, 48);
			this.examC.Name = "examC";
			this.examC.Size = new System.Drawing.Size(120, 21);
			this.examC.TabIndex = 7;
			this.examC.Text = "";
			// 
			// label5
			// 
			this.label5.Location = new System.Drawing.Point(16, 56);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(64, 16);
			this.label5.TabIndex = 6;
			this.label5.Text = "还剩试题";
			// 
			// label3
			// 
			this.label3.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(0)), ((System.Byte)(0)));
			this.label3.Location = new System.Drawing.Point(264, 32);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(112, 16);
			this.label3.TabIndex = 4;
			this.label3.Text = "请先选择分数级别";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(72, 88);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(448, 32);
			this.label2.TabIndex = 2;
			// 
			// fenType
			// 
			this.fenType.Items.AddRange(new object[] {
														 "10分题",
														 "20分题",
														 "30分题"});
			this.fenType.Location = new System.Drawing.Point(72, 24);
			this.fenType.Name = "fenType";
			this.fenType.Size = new System.Drawing.Size(176, 20);
			this.fenType.TabIndex = 1;
			this.fenType.SelectedIndexChanged += new System.EventHandler(this.fenType_SelectedIndexChanged);
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(16, 32);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(64, 16);
			this.label1.TabIndex = 0;
			this.label1.Text = "分数级别";
			// 
			// button2
			// 
			this.button2.Location = new System.Drawing.Point(488, 184);
			this.button2.Name = "button2";
			this.button2.Size = new System.Drawing.Size(64, 23);
			this.button2.TabIndex = 2;
			this.button2.Text = "放弃";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// timer
			// 
			this.timer.Interval = 200;
			this.timer.Tick += new System.EventHandler(this.timer_Tick);
			// 
			// SelectExam
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(560, 215);
			this.Controls.Add(this.button2);
			this.Controls.Add(this.groupBox1);
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "SelectExam";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "选择试题";
			this.groupBox1.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// 放弃
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void button2_Click(object sender, System.EventArgs e) {
			this.main.cuMSG = "{{{NOSELECTEXAM}}}" + "XXXX";
			this.main.ipStr.Clear();
			this.main.ipStr.Add(this.main.serverIP+"->");
			this.main.SendToClient();
			this.Close();
		}

		/// <summary>
		/// 选定题目
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void button1_Click(object sender, System.EventArgs e) {
			if(this.examC_.Text != ""){
				this.main.cuMSG = "{{{SELECTEXAMCOUNT}}}" + this.examC_.Text + "|||" + this.fenType.Text;
				this.main.ipStr.Clear();
				this.main.ipStr.Add(this.main.serverIP+"->");
				this.main.SendToClient();
				this.Close();
			}
		}

		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void fenType_SelectedIndexChanged(object sender, System.EventArgs e) {
			if(this.actionS){
				this.main.cuMSG = "{{{FEN}}}" + this.fenType.Text;
				this.main.ipStr.Clear();
				this.main.ipStr.Add(this.main.serverIP+"->");
				this.main.SendToClient();
				this.timer.Start();
				this.Close();
			}
		}

		private void timer_Tick(object sender, System.EventArgs e) {

			if(Config.examCou != "0"){

				this.timer.Stop();
				this.examC.Text        = Config.examCou;
				this.examC_.Enabled    = true;

				int ec = Int32.Parse(Config.examCou);
				this.examC_.Items.Clear();
				for(int i=1;i<=ec;i++){
					this.examC_.Items.Add(i);
				}

				this.label2.Text = "你选择了{"+ this.fenType.Text +"},目前该分数级别的题库中还有{"+ this.examC.Text +"}道题,请在下面的选择框中选择{1-"+ this.examC.Text +"}之间的任一数字!";
			}
		}

		private void examC__SelectedIndexChanged(object sender, System.EventArgs e) {
			if(this.actionS && this.examC_.Text != ""){
				this.main.cuMSG = "{{{SELECTEXAMCOUNT}}}" + this.examC_.Text + "|||" + this.fenType.Text;
				this.main.ipStr.Clear();
				this.main.ipStr.Add(this.main.serverIP+"->");
				this.main.SendToClient();
				this.Close();
				this.actionS = false;
			}
		}
	}
}

⌨️ 快捷键说明

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