• 大小: 183KB
    文件类型: .zip
    金币: 2
    下载: 2 次
    发布日期: 2021-09-23
  • 语言: C#
  • 标签:

资源简介

C#入门,简易的答题系统,适合初学者

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace InlineExamSystem
{
    public partial class Dati : Form
    {
        //当前正在做的题的下标
        public int Index { get; set; }

        public Dati()
        {
            InitializeComponent();

            Index = 0; //从选择课程进入,显示第1题
        }

        public Dati(int  i)
        {
            InitializeComponent();

            Index = i; //从答题卡进入,显示指定的第 i  题
        }

        private void label1_Click(object sender EventArgs e)
        {

        }

        private void timer1_Tick(object sender EventArgs e)
        {
            Paper.TimeLength--;
            if (Paper.TimeLength > 0)
            {
                //还有时间就显示时间
                lblTime.Text = string.Format(“{0}:{1}“Paper.TimeLength/60Paper.TimeLength%60);
            }
            else
            {
                //强制叫卷
                KaoShiJieGuo jg = new KaoShiJieGuo();
                jg.MdiParent = this.MdiParent;
                jg.Show();

                this.Close();
            }
        }

        private void Dati_Load(object sender EventArgs e)
        { 
            //显示第  index 道题
            ShowQuestion();
        }

        private void btnNext_Click(object sender EventArgs e)
        {
            Index++;
            if (Index >= Paper.Questions.Length)
                Index = 0;

            //显示第  index 道题
            ShowQuestion();
        }

        private void ShowQuestion()
        {
            //从试卷中取出题目
            Question ques = Paper.Questions[Index];

            //将题目内容显示到每个控件中
            lblNo.Text = string.Format(“{0} 题“Index+1);
            txtContent.Text = ques.Content;
            rboA.Text = “A “ + ques.OptionA;
            rboB.Text = “B “ + ques.OptionB;
            rboC.Text = “C “ + ques.OptionC;
            rboD.Text = “D “ + ques.OptionD;

            //显示学生做的答案 Checked
            if (ques.AnswerOfStu == “未作答“)
            {
                rboA.Checked = false;
                rboB.Checked = false;
                rboC.Checked = false;
                rboD.Checked = false;
            }
            else
            {
                switch (ques.AnswerOfStu)
                {
                    case “A“: rboA.Checked = true; break;
                    case “B“: rboB.Checked = true; break;
                    case “C“: rboC.Checked = true; break;
                    case “D“: rboD.Checked = true; break;
                }
            }
        }

        private void rboA_Click(object sender EventArgs e)
        {
            //记录学生做的答案
            string answer = “A“;
            if (rboB.Checked) answer = “B“;
            if (rboC.Checked) answer = “C“;
            if (rboD.Checked) answer =

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2016-04-07 19:35  InlineExamSystem\
     文件       42557  2016-03-19 15:18  InlineExamSystem\1.jpg
     目录           0  2016-04-07 19:19  InlineExamSystem\InlineExamSystem\
     文件         938  2016-03-24 10:45  InlineExamSystem\InlineExamSystem.sln
     文件       78336  2016-04-12 21:57  InlineExamSystem\InlineExamSystem.v11.suo
     文件         346  2016-04-06 19:38  InlineExamSystem\InlineExamSystem\App.config
     目录           0  2016-03-31 10:43  InlineExamSystem\InlineExamSystem\bin\
     目录           0  2016-03-31 10:43  InlineExamSystem\InlineExamSystem\bin\Debug\
     文件       39424  2016-04-12 19:11  InlineExamSystem\InlineExamSystem\bin\Debug\InlineExamSystem.exe
     文件         346  2016-04-06 19:38  InlineExamSystem\InlineExamSystem\bin\Debug\InlineExamSystem.exe.config
     文件      101888  2016-04-12 19:11  InlineExamSystem\InlineExamSystem\bin\Debug\InlineExamSystem.pdb
     文件       22984  2016-04-12 21:56  InlineExamSystem\InlineExamSystem\bin\Debug\InlineExamSystem.vshost.exe
     文件         346  2016-04-06 19:38  InlineExamSystem\InlineExamSystem\bin\Debug\InlineExamSystem.vshost.exe.config
     文件         490  2015-10-30 15:19  InlineExamSystem\InlineExamSystem\bin\Debug\InlineExamSystem.vshost.exe.manifest
     文件        3656  2016-03-31 09:30  InlineExamSystem\InlineExamSystem\Dati.cs
     文件        9176  2016-03-31 08:59  InlineExamSystem\InlineExamSystem\Dati.Designer.cs
     文件        6011  2016-03-31 08:59  InlineExamSystem\InlineExamSystem\Dati.resx
     文件        2431  2016-04-07 19:21  InlineExamSystem\InlineExamSystem\DaTiKa.cs
     文件       25746  2016-04-07 19:21  InlineExamSystem\InlineExamSystem\DaTiKa.Designer.cs
     文件        6011  2016-04-07 19:21  InlineExamSystem\InlineExamSystem\DaTiKa.resx
     文件        4191  2016-04-07 19:39  InlineExamSystem\InlineExamSystem\Form1.cs
     文件        6142  2016-03-29 15:58  InlineExamSystem\InlineExamSystem\Form1.Designer.cs
     文件        5817  2016-03-29 16:35  InlineExamSystem\InlineExamSystem\Form1.resx
     文件        3029  2016-03-31 09:38  InlineExamSystem\InlineExamSystem\frmSelectSubject.cs
     文件        4829  2016-03-30 19:07  InlineExamSystem\InlineExamSystem\frmSelectSubject.Designer.cs
     文件        5817  2016-03-30 19:07  InlineExamSystem\InlineExamSystem\frmSelectSubject.resx
     文件        1052  2016-04-07 19:21  InlineExamSystem\InlineExamSystem\frmStudentMain.cs
     文件        5929  2016-04-07 19:21  InlineExamSystem\InlineExamSystem\frmStudentMain.Designer.cs
     文件        6015  2016-04-07 19:21  InlineExamSystem\InlineExamSystem\frmStudentMain.resx
     文件        5955  2016-04-07 19:21  InlineExamSystem\InlineExamSystem\InlineExamSystem.csproj
     文件        1223  2016-04-07 19:37  InlineExamSystem\InlineExamSystem\KaoShiJieGuo.cs
............此处省略36个文件信息

评论

共有 条评论

相关资源