Ejemplo n.º 1
0
        //转到相应的题目
        private void btnQuestion_Click(object sender, EventArgs e)
        {
            int index = Convert.ToInt32(((Button)sender).Tag);
            AnswerQuestionForm answerQuestion = new AnswerQuestionForm();

            answerQuestion.index = index;
            //answerQuestion.MdiParent = this.MdiParent;
            answerQuestion.Show();
            this.Close();
        }
Ejemplo n.º 2
0
        //开始答题
        private void btnBegin_Click(object sender, EventArgs e)
        {
            //if (cboSubjects.SelectedIndex == -1)
            //{
            //    MessageBox.Show("请选择科目!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //    cboSubjects.Focus();
            //}
            //else
            //{
            ////获得选中科目的Id
            //int majorId = getMajorId(cboSubjects);
            //该科目问题总数
            int allQuestionCount = getQuestionCount(UserHelper.currentMajorId, 1);

            if (allQuestionCount < 20)
            {
                MessageBox.Show("该专业题库中没有足够的题目!", "基于虚拟现实的铁路综合运输训练系统", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            //指定所有问题数组的长度
            TestHelper.allQuestionId = new int[allQuestionCount];
            //指定记录问题是否选中的数组的长度
            TestHelper.selectedState = new bool[allQuestionCount];
            //为所有问题数组元素赋值
            setAllQuestionId(UserHelper.currentMajorId);
            //抽题
            setSelectedQuestionId();
            //取出标准答案
            setRightAnswer();
            //剩余时间为20分钟
            TestHelper.remainSeconds = TestHelper.totalSeconds;
            //将学生答案数组初始化
            for (int i = 0; i < TestHelper.studentAnswer.Length; i++)
            {
                TestHelper.studentAnswer[i] = "未回答";
            }
            //打开答题窗体
            AnswerQuestionForm answerQuestion = new AnswerQuestionForm();

            //answerQuestion.MdiParent = this.MdiParent;
            answerQuestion.Show();
            //不能hide,会导致DialogResult不为ok
            this.Opacity = 0D;
            //}
        }