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

📄 form_csh.cs

📁 一个很简单的考试系统。实用性很强啊!数据库在里面
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.IO;

namespace bizdb
{
	/// <summary>
	/// Form_csh 的摘要说明。
	/// </summary>
	public class Form_csh : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Panel pnl_csh;
		private System.Windows.Forms.Label lbl_csh3;
		private System.Windows.Forms.Button btn_qk3;
		private System.Windows.Forms.Button btn_qk2;
		private System.Windows.Forms.Label lbl_csh2;
		private System.Windows.Forms.PictureBox pcb_csh6;
		private System.Windows.Forms.PictureBox pcb_csh5;
		private System.Windows.Forms.PictureBox pcb_csh4;
		private System.Windows.Forms.PictureBox pcb_csh3;
		private System.Windows.Forms.PictureBox pcb_csh2;
		private System.Windows.Forms.Button btn_qk1;
		private System.Windows.Forms.Label lbl_csh1;
		private System.Windows.Forms.PictureBox pcb_csh1;
		private System.Windows.Forms.Button btn_qx;
		private System.Windows.Forms.Button btn_csh;
		private System.Windows.Forms.TextBox txt_xtmc;
		private System.Windows.Forms.Label lbl_xtmc;
		private System.Windows.Forms.Label lbl_sm;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

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

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form_csh));
			this.pnl_csh = new System.Windows.Forms.Panel();
			this.lbl_csh3 = new System.Windows.Forms.Label();
			this.btn_qk3 = new System.Windows.Forms.Button();
			this.btn_qk2 = new System.Windows.Forms.Button();
			this.lbl_csh2 = new System.Windows.Forms.Label();
			this.pcb_csh6 = new System.Windows.Forms.PictureBox();
			this.pcb_csh5 = new System.Windows.Forms.PictureBox();
			this.pcb_csh4 = new System.Windows.Forms.PictureBox();
			this.pcb_csh3 = new System.Windows.Forms.PictureBox();
			this.pcb_csh2 = new System.Windows.Forms.PictureBox();
			this.btn_qk1 = new System.Windows.Forms.Button();
			this.lbl_csh1 = new System.Windows.Forms.Label();
			this.pcb_csh1 = new System.Windows.Forms.PictureBox();
			this.btn_qx = new System.Windows.Forms.Button();
			this.btn_csh = new System.Windows.Forms.Button();
			this.txt_xtmc = new System.Windows.Forms.TextBox();
			this.lbl_xtmc = new System.Windows.Forms.Label();
			this.lbl_sm = new System.Windows.Forms.Label();
			this.pnl_csh.SuspendLayout();
			this.SuspendLayout();
			// 
			// pnl_csh
			// 
			this.pnl_csh.Controls.AddRange(new System.Windows.Forms.Control[] {
																				  this.lbl_csh3,
																				  this.btn_qk3,
																				  this.btn_qk2,
																				  this.lbl_csh2,
																				  this.pcb_csh6,
																				  this.pcb_csh5,
																				  this.pcb_csh4,
																				  this.pcb_csh3,
																				  this.pcb_csh2,
																				  this.btn_qk1,
																				  this.lbl_csh1,
																				  this.pcb_csh1,
																				  this.btn_qx,
																				  this.btn_csh,
																				  this.txt_xtmc,
																				  this.lbl_xtmc,
																				  this.lbl_sm});
			this.pnl_csh.Location = new System.Drawing.Point(16, 56);
			this.pnl_csh.Name = "pnl_csh";
			this.pnl_csh.Size = new System.Drawing.Size(760, 448);
			this.pnl_csh.TabIndex = 0;
			this.pnl_csh.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint);
			// 
			// lbl_csh3
			// 
			this.lbl_csh3.Location = new System.Drawing.Point(144, 328);
			this.lbl_csh3.Name = "lbl_csh3";
			this.lbl_csh3.Size = new System.Drawing.Size(408, 16);
			this.lbl_csh3.TabIndex = 16;
			this.lbl_csh3.Text = "清空所有基本表数据,即所有的码表,此项功能慎用,必须先清空二级数据表.";
			// 
			// btn_qk3
			// 
			this.btn_qk3.Location = new System.Drawing.Point(632, 320);
			this.btn_qk3.Name = "btn_qk3";
			this.btn_qk3.Size = new System.Drawing.Size(56, 23);
			this.btn_qk3.TabIndex = 15;
			this.btn_qk3.Text = "清空";
			// 
			// btn_qk2
			// 
			this.btn_qk2.Location = new System.Drawing.Point(632, 232);
			this.btn_qk2.Name = "btn_qk2";
			this.btn_qk2.Size = new System.Drawing.Size(56, 23);
			this.btn_qk2.TabIndex = 14;
			this.btn_qk2.Text = "清空";
			// 
			// lbl_csh2
			// 
			this.lbl_csh2.Location = new System.Drawing.Point(140, 240);
			this.lbl_csh2.Name = "lbl_csh2";
			this.lbl_csh2.Size = new System.Drawing.Size(428, 16);
			this.lbl_csh2.TabIndex = 13;
			this.lbl_csh2.Text = "清空所有二级数据表,包括课程表,试题表,试卷结构表等,必须先清空数据表.";
			// 
			// pcb_csh6
			// 
			this.pcb_csh6.Image = ((System.Drawing.Bitmap)(resources.GetObject("pcb_csh6.Image")));
			this.pcb_csh6.Location = new System.Drawing.Point(96, 312);
			this.pcb_csh6.Name = "pcb_csh6";
			this.pcb_csh6.Size = new System.Drawing.Size(40, 32);
			this.pcb_csh6.TabIndex = 12;
			this.pcb_csh6.TabStop = false;
			// 
			// pcb_csh5
			// 
			this.pcb_csh5.Image = ((System.Drawing.Bitmap)(resources.GetObject("pcb_csh5.Image")));
			this.pcb_csh5.Location = new System.Drawing.Point(64, 312);
			this.pcb_csh5.Name = "pcb_csh5";
			this.pcb_csh5.Size = new System.Drawing.Size(40, 32);
			this.pcb_csh5.TabIndex = 11;
			this.pcb_csh5.TabStop = false;
			// 
			// pcb_csh4
			// 
			this.pcb_csh4.Image = ((System.Drawing.Bitmap)(resources.GetObject("pcb_csh4.Image")));
			this.pcb_csh4.Location = new System.Drawing.Point(32, 312);
			this.pcb_csh4.Name = "pcb_csh4";
			this.pcb_csh4.Size = new System.Drawing.Size(40, 32);
			this.pcb_csh4.TabIndex = 10;
			this.pcb_csh4.TabStop = false;
			// 
			// pcb_csh3
			// 
			this.pcb_csh3.Image = ((System.Drawing.Bitmap)(resources.GetObject("pcb_csh3.Image")));
			this.pcb_csh3.Location = new System.Drawing.Point(80, 224);
			this.pcb_csh3.Name = "pcb_csh3";
			this.pcb_csh3.Size = new System.Drawing.Size(40, 32);
			this.pcb_csh3.TabIndex = 9;
			this.pcb_csh3.TabStop = false;
			// 
			// pcb_csh2
			// 
			this.pcb_csh2.Image = ((System.Drawing.Bitmap)(resources.GetObject("pcb_csh2.Image")));
			this.pcb_csh2.Location = new System.Drawing.Point(48, 224);
			this.pcb_csh2.Name = "pcb_csh2";
			this.pcb_csh2.Size = new System.Drawing.Size(32, 32);
			this.pcb_csh2.TabIndex = 8;
			this.pcb_csh2.TabStop = false;
			// 
			// btn_qk1
			// 
			this.btn_qk1.Location = new System.Drawing.Point(632, 144);
			this.btn_qk1.Name = "btn_qk1";
			this.btn_qk1.Size = new System.Drawing.Size(56, 23);
			this.btn_qk1.TabIndex = 7;
			this.btn_qk1.Text = "清空";
			// 
			// lbl_csh1
			// 
			this.lbl_csh1.Location = new System.Drawing.Point(136, 152);
			this.lbl_csh1.Name = "lbl_csh1";
			this.lbl_csh1.Size = new System.Drawing.Size(480, 16);
			this.lbl_csh1.TabIndex = 6;
			this.lbl_csh1.Text = "清空所有的数据表,包括教学单元表,正确答案表,党员资料表,教职工资料表等最终数据.";
			// 
			// pcb_csh1
			// 
			this.pcb_csh1.Image = ((System.Drawing.Bitmap)(resources.GetObject("pcb_csh1.Image")));
			this.pcb_csh1.Location = new System.Drawing.Point(64, 136);
			this.pcb_csh1.Name = "pcb_csh1";
			this.pcb_csh1.Size = new System.Drawing.Size(40, 32);
			this.pcb_csh1.TabIndex = 5;
			this.pcb_csh1.TabStop = false;
			// 
			// btn_qx
			// 
			this.btn_qx.Location = new System.Drawing.Point(552, 72);
			this.btn_qx.Name = "btn_qx";
			this.btn_qx.Size = new System.Drawing.Size(56, 23);
			this.btn_qx.TabIndex = 4;
			this.btn_qx.Text = "取消";
			// 
			// btn_csh
			// 
			this.btn_csh.Location = new System.Drawing.Point(480, 72);
			this.btn_csh.Name = "btn_csh";
			this.btn_csh.Size = new System.Drawing.Size(56, 23);
			this.btn_csh.TabIndex = 3;
			this.btn_csh.Text = "初始化";
			this.btn_csh.Click += new System.EventHandler(this.btn_csh_Click);
			// 
			// txt_xtmc
			// 
			this.txt_xtmc.Location = new System.Drawing.Point(120, 72);
			this.txt_xtmc.Name = "txt_xtmc";
			this.txt_xtmc.Size = new System.Drawing.Size(336, 21);
			this.txt_xtmc.TabIndex = 2;
			this.txt_xtmc.Text = "";
			// 
			// lbl_xtmc
			// 
			this.lbl_xtmc.Location = new System.Drawing.Point(56, 72);
			this.lbl_xtmc.Name = "lbl_xtmc";
			this.lbl_xtmc.Size = new System.Drawing.Size(56, 16);
			this.lbl_xtmc.TabIndex = 1;
			this.lbl_xtmc.Text = "系统名称";
			// 
			// lbl_sm
			// 
			this.lbl_sm.Location = new System.Drawing.Point(24, 40);
			this.lbl_sm.Name = "lbl_sm";
			this.lbl_sm.Size = new System.Drawing.Size(656, 16);
			this.lbl_sm.TabIndex = 0;
			this.lbl_sm.Text = "说明:以下输入框为更改系统名称,此名称将出现在登录对话框,主窗口标题;Windows任务栏;关于对话框和系统状态栏中;";
			// 
			// Form_csh
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(792, 573);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.pnl_csh});
			this.Name = "Form_csh";
			this.Text = "系统初始化";
			this.Load += new System.EventHandler(this.Form_csh_Load);
			this.pnl_csh.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		private void panel1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
		{
		
		}

		private void Form_csh_Load(object sender, System.EventArgs e)
		{
			this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
			this.ControlBox = false;
		}

		private void btn_csh_Click(object sender, System.EventArgs e)
		{
			common c = new common();
			StreamWriter srw;
			if(File.Exists("name.ini"))
			{
				File.Delete("name.ini");				
				srw = File.CreateText("name.ini");				
			}
			else
			{
				srw = File.CreateText("name.ini");
			}
			srw.WriteLine(txt_xtmc.Text);
			c.sysname = txt_xtmc.Text;
			srw.Close();
			this.ParentForm.Text = c.sysname + "课程体系试题库系统";
		}
	}
}

⌨️ 快捷键说明

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