コード例 #1
0
        // 交卷
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            // 创建答题结果窗体并显示,关闭当前窗体
            QuizResultForm quizResultForm = new QuizResultForm();

            quizResultForm.MdiParent = this.MdiParent;
            quizResultForm.Show();
            this.Close();
        }
コード例 #2
0
        // 计时器的 Tick 事件
        private void tmrCostTime_Tick(object sender, EventArgs e)
        {
            int minute;   // 当前的分钟
            int second;   // 秒

            // 如果还剩有答题时间,就显示剩余的时间
            if (QuizHelper.remainSeconds > 0)
            {
                minute        = QuizHelper.remainSeconds / 60;
                second        = QuizHelper.remainSeconds % 60;
                lblTimer.Text = string.Format("{0:00}:{1:00}", minute, second);  // 补充知识点
                QuizHelper.remainSeconds--;
            }
            // 否则,停止计时,提示交卷
            else
            {
                tmrCostTime.Stop();
                MessageBox.Show("时间到了,该交卷了!", "上海电力学院在线考试系统", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                QuizResultForm quizResultForm = new QuizResultForm();
                quizResultForm.Show();
                this.Close();
            }
        }
コード例 #3
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            int minute;   // 当前的分钟
            int second;   // 秒

            // 如果还有剩余时间,就显示剩余的分钟和秒数
            if (QuizHelper.remainSeconds > 0)
            {
                QuizHelper.remainSeconds--;
                minute        = QuizHelper.remainSeconds / 60;
                second        = QuizHelper.remainSeconds % 60;
                lblTimer.Text = string.Format("{0:00}:{1:00}", minute, second);
            }
            // 否则,就提示交卷
            else
            {
                timer1.Stop();
                MessageBox.Show("时间到了,该交卷了!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                QuizResultForm quizResultForm = new QuizResultForm();
                quizResultForm.MdiParent = this.MdiParent;
                quizResultForm.Show();
                this.Close();
            }
        }