コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            int           questionIndex = Convert.ToInt32(((Button)sender).Tag);
            int           q             = questionIndex - 1;
            QuestionsForm questionF     = new QuestionsForm();

            //将题目的索引传到回答问题窗体
            QuestionsForm.questionIndex = q;
            questionF.MdiParent         = this.MdiParent;
            questionF.Show();
            this.Close();
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < QuizHelper.studentAnswers.Length; i++)
            {
                QuizHelper.studentAnswers[i] = QuizHelper.correctAnswers[i];
            }
            int           questionIndex = Convert.ToInt32(((Button)sender).Tag);
            QuestionsForm questionF     = new QuestionsForm();

            QuestionsForm.questionIndex = questionIndex;
            questionF.MdiParent         = this.MdiParent;
            questionF.Show();
            this.Close();
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            //获得选中科目的id
            int subjectid = (int)comboBox1.SelectedValue;

            StudentHelper.subjectId = subjectid;
            //该科目的问题总数
            int allquestioncount = GetQuestionCount(subjectid);

            if (allquestioncount < QuizHelper.questionNum)
            {
                MessageBox.Show("试题数量少于20条,不能获取试题");
                return;
            }
            //指定所有问题数组的长度
            QuizHelper.allQuestionIds = new int[allquestioncount];
            //指定问题是否选中的数组的长度
            QuizHelper.selectedStates = new bool[allquestioncount];
            //为所有问题数组赋值,赋予所有问题的id号
            SetAllQuestionIds(subjectid);
            //抽取questionid
            SetselectQuestionIds();
            //取出标准答案
            SetRightAnswer();
            //剩余时间为20分钟
            QuizHelper.remainSeconds = 1200;
            //将学生答案数组初始化
            for (int i = 0; i < QuizHelper.studentAnswers.Length; i++)
            {
                QuizHelper.studentAnswers[i] = "未回答";
            }
            //打开答案窗体
            QuestionsForm questionForm = new QuestionsForm();

            questionForm.MdiParent = this.MdiParent;
            questionForm.Show();
        }