模拟考试系统C#源码

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

开始窗体//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;namespaceExam{publicpartialclassExamForm:Form{publicExamForm(){InitializeComponent();}///summary///ExamForm////summary///paramname=sender/param///paramname=e/paramprivatevoidExamForm_Load(objectsender,EventArgse){CenterToScreen();Text=模拟考试系统;this.Width=360;this.Height=230;this.progressBar1.Width=360;this.progressBar1.Height=10;this.progressBar1.Left=0;this.progressBar1.Top=220;this.timer1.Start();}inti=8;privatevoidtimer1_Tick(objectsender,EventArgse){this.progressBar1.PerformStep();i--;if(i==0){this.timer1.Stop();FormExamf=newFormExam();f.Show();this.Hide();}}}}数据库辅助类//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Data;usingSystem.Data.SqlClient;namespaceExam{publicclassDataBase{publicstringconnString=@DataSource=XUTAO;InitialCatalog=Exam;IntegratedSecurity=True;privateSqlConnectionconn;///summary///SqlConnection////summarypublicSqlConnectionConn{get{if(conn==null){conn=newSqlConnection(connString);}returnconn;}}///summary///打开数据库////summarypublicvoidopenData(){if(Conn.State==ConnectionState.Closed){Conn.Open();}elseif(Conn.State==ConnectionState.Broken){Conn.Close();Conn.Open();}}///summary///关闭数据库////summarypublicvoidcloseData(){if(Conn.State==ConnectionState.Open||Conn.State==ConnectionState.Broken){Conn.Close();}}}}主窗体//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.Data.SqlClient;namespaceExam{publicpartialclassFormExam:Form{publicFormExam(){InitializeComponent();}///summary///调用数据库////summaryDataBasedb=newDataBase();///summary///ExamForm////summary///paramname=sender/param///paramname=e/paramprivatevoidFormExam_Load(objectsender,EventArgse){CenterToScreen();this.Cursor=Cursors.Hand;this.Text=模拟考试系统;this.tscmbExamType.SelectedIndex=0;this.timerDate.Start();this.Width=1000;this.Height=600;this.MaximizeBox=false;this.Top=50;this.groupBox1.Top=40;this.groupBox1.Left=10;this.groupBox1.Height=250;this.groupBox1.Width=200;this.listExam.GridLines=true;this.listExam.FullRowSelect=true;this.groupBox2.BackColor=Color.Transparent;this.groupBox2.Text=试题题干;this.groupBox2.Height=250;this.groupBox2.Width=755;this.groupBox2.Left=215;this.groupBox2.Top=40;this.groupBox2.ForeColor=Color.White;this.rtbExam.ReadOnly=true;this.groupBox3.Text=试题选项;this.groupBox3.ForeColor=Color.White;this.groupBox3.BackColor=Color.Transparent;this.groupBox3.Left=215;this.groupBox3.Width=755;this.groupBox3.Height=250;this.groupBox3.Top=295;this.groupBox4.Text=操作区域;this.groupBox4.ForeColor=Color.White;this.groupBox4.BackColor=Color.Transparent;this.groupBox4.Width=200;this.groupBox4.Height=250;this.groupBox4.Top=295;this.groupBox4.Left=10;this.button1.Text=开始答题;this.button1.Top=40;this.button1.Left=50;this.button1.Width=90;this.button1.Height=25;this.button1.ForeColor=Color.Blue;this.button2.Text=上一试题;this.button2.Top=80;this.button2.Left=50;this.button2.Width=90;this.button2.Height=25;this.button2.ForeColor=Color.Blue;this.button3.Text=下一试题;this.button3.Top=120;this.button3.Left=50;this.button3.Width=90;this.button3.Height=25;this.button3.ForeColor=Color.Blue;this.button4.Text=停止答题;this.button4.Top=160;this.button4.Left=50;this.button4.Width=90;this.button4.Height=25;this.button4.ForeColor=Color.Blue;this.button5.Text=提交试题;this.button5.Top=200;this.button5.Left=50;this.button5.Width=90;this.button5.Height=25;this.button5.ForeColor=Color.Blue;this.radioButton1.Text=A;this.radioButton1.Left=5;this.radioButton1.Top=50;this.radioButton1.ForeColor=Color.GreenYellow;this.radioButton1.Enabled=false;this.radioButton2.Text=B;this.radioButton2.Left=5;this.radioButton2.Top=100;this.radioButton2.ForeColor=Color.GreenYellow;this.radioButton2.Enabled=false;this.radioButton3.Text=C;this.radioButton3.Left=5;this.radioButton3.Top=150;this.radioButton3.ForeColor=Color.GreenYellow;this.radioButton3.Enabled=false;this.radioButton4.Text=D;this.radioButton4.Left=5;this.radioButton4.Top=200;this.radioButton4.ForeColor=Color.GreenYellow;this.radioButton4.Enabled=false;this.label1.Left=40;this.label1.Top=52;this.label1.Text=;this.label2.Left=40;this.label2.Top=102;this.label2.Text=;this.label3.Left=40;this.label3.Top=152;this.label3.Text=;this.label4.Left=40;this.label4.Top=202;this.label4.Text=;this.label5.Left=5;this.label5.Top=20;this.label5.Text=;this.label5.ForeCol

1 / 26
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功