Beispiel #1
0
        // 顯示本題 題目及選項

        /*private bool exam(int i)
         * {
         *  bool r = false;
         *  if (i < question.Length)
         *  {
         *      lblQuestion.Text = question[i].getQuestion();
         *      radioButton1.Text = "(A) " + question[i].getAnswerA();
         *      radioButton2.Text = "(B) " + question[i].getAnswerB();
         *      radioButton3.Text = "(C) " + question[i].getAnswerC();
         *      radioButton4.Text = "(D) " + question[i].getAnswerD();
         *      usersAnswer();
         *      mark();
         *      r = true;
         *
         *      ef.lblQuestion.Text = question[i].getQuestion();
         *      ef.radioButton1.Text = "(A) " + question[i].getAnswerA();
         *      ef.radioButton2.Text = "(B) " + question[i].getAnswerB();
         *      ef.radioButton3.Text = "(C) " + question[i].getAnswerC();
         *      ef.radioButton4.Text = "(D) " + question[i].getAnswerD();
         *      usersAnswer();
         *      mark();
         *      r = true;
         *  }
         *  return r;
         * }*/

        // ???紀錄作答完畢後需要檢查之題目

        // 顯示答案之實做

        /* private void showAnswer()
         * {
         *   if(question[examIndex].getShowAnswer())
         *   {
         *       //顯示答案
         *       foreach (RadioButton r in selections)
         *       {
         *        //去掉選項標頭 ex.(A) (B) (C) (D)
         *        if (r.Text.Substring(4) == question[examIndex].getAnswer())
         *              r.ForeColor = Color.Green;
         *        else
         *             r.ForeColor = Color.Red;
         *       }
         *   }
         *   else
         *   {
         *       //把選項顏色恢復 黑色
         *       foreach (RadioButton r in selections)
         *          r.ForeColor = Color.Black;
         *       btnAns.Text = "顯示答案";
         *   }
         * }*/

        // 控制 CheckBox 勾選狀態

        /*private void usersAnswer()
         * {
         *  if (question[examIndex].getUsersAnswer() != "")
         *  {
         *      if (question[examIndex].getUsersAnswer() == "A")
         *          radioButton1.Checked = true;
         *      else if (question[examIndex].getUsersAnswer() == "B")
         *          radioButton2.Checked = true;
         *      else if (question[examIndex].getUsersAnswer() == "C")
         *          radioButton3.Checked = true;
         *      else if (question[examIndex].getUsersAnswer() == "D")
         *          radioButton4.Checked = true;
         *  }
         *  else
         *  {
         *      radioButton1.Checked = false;
         *      radioButton2.Checked = false;
         *      radioButton3.Checked = false;
         *      radioButton4.Checked = false;
         *  }
         * }*/

        #region 使用者控制項

        private void download()
        {
            //傳遞下載路徑
            veSocket.Download(DownloadForm.dlExam);
            //veSocket中的MyExcelCollection物件不為空,表示已成功由遠端伺服器下載題庫至該物件內
            if (veSocket.getMyExcelCollection() != null)
            {
                //label1.Text = "題庫:" + DownloadForm.dlExam;
                //將該題庫放入用戶端MyExcelCollection物件
                question = veSocket.getMyExcelCollection();
                //label5.Text = Convert.ToString(question.Length);
                //exam(0);
                question[0].setExamName(dlf.getExamName());
                saveExam.save(question, dlf.getExamName());
                Form.CheckForIllegalCrossThreadCalls = false;
                dlf.lblStat.Text = "狀態:下載完成!!";
            }
        }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            SaveExam se = new SaveExam();
            int      eh = 0;

            for (int i = 0; i < question.Length; i++)
            {
                //重置使用者作答答案
                question[i].setUsersAnswer("");
                //重置顯示答案狀態
                question[i].setShowAnswer(false);
                //同步加強練習之陣列與正常模式之陣列
                if (eh < enhanceQuestion.Length && question[i].getQuestion() == enhanceQuestion[eh].getQuestion())
                {
                    question[i].setEnhance(enhanceQuestion[eh].getEnhance());
                    eh++;
                }
            }
            //儲存正常模式之陣列
            se.save(question, question[0].getExamName());
        }