示例#1
0
 bool marked()
 {
     foreach (object o in unSureList.Items)
     {
         Unsure u = o as Unsure;
         if (u.single == single && u.num == q)
         {
             return(true);
         }
     }
     return(false);
 }
示例#2
0
 void mark()
 {
     foreach (object o in unSureList.Items)
     {
         Unsure u = o as Unsure;
         if (u.single == single && u.num == q)
         {
             unSureList.Items.Remove(o);
             question[4].chosen = false;
             return;
         }
     }
     question[4].chosen = true;
     unSureList.Items.Add(new Unsure(single, q));
     return;
 }
示例#3
0
    public Exam()
    {
        paper = new Paper();
        Text  = "模拟考试";

        MenuStrip         menu         = new MenuStrip();
        ToolStripMenuItem handin       = new ToolStripMenuItem("交卷", null, delegate { this.handin(); });
        ToolStripMenuItem lastQuestion = new ToolStripMenuItem("上一题", null, delegate { this.lastQuestion(); showQuestion(); });
        ToolStripMenuItem nextQuestion = new ToolStripMenuItem("下一题", null, delegate { this.nextQuestion(); showQuestion(); });

        menu.Items.Add(handin);
        menu.Items.Add(lastQuestion);
        menu.Items.Add(nextQuestion);

        question[4] = new Choice(4, "", new Rectangle(40, 40, 900, 200), delegate { mark(); });
        for (int i = 0; i < 4; i++)
        {
            question[i] = new Choice(i, "", new Rectangle(40, 100 * i + 240, 900, 100), click);
        }

        time.ForeColor = Color.Tomato;
        time.Font      = new Font("Consolas", 20, FontStyle.Bold);
        time.Location  = new Point(960, 30);
        time.Size      = new Size(300, 50);


        Label singleLable = new Label();

        singleLable.Location = new Point(950, 100);
        singleLable.Text     = "单选题";
        singleList.Location  = new Point(950, 120);
        singleList.Font      = new Font("Consolas", 10, FontStyle.Bold);
        singleList.Size      = new Size(300, 150);

        Label multiLable = new Label();

        multiLable.Location = new Point(950, 270);
        multiLable.Text     = "多选题";
        multiList.Font      = new Font("Consolas", 10, FontStyle.Bold);
        multiList.Location  = new Point(950, 290);
        multiList.Size      = new Size(300, 150);
        Label unSureLabel = new Label();

        unSureLabel.Location = new Point(950, 445);
        unSureLabel.Text     = "标记题";
        unSureList.Location  = new Point(950, 460);
        unSureList.Size      = new Size(300, 220);
        unSureList.Font      = new Font("Consolas", 10, FontStyle.Bold);

        singleList.SelectedIndexChanged += delegate { q = singleList.SelectedIndex; single = true; showQuestion(); };
        multiList.SelectedIndexChanged  += delegate { q = multiList.SelectedIndex; single = false; showQuestion(); };
        unSureList.SelectedIndexChanged += delegate
        {
            Unsure u = unSureList.SelectedItem as Unsure;
            if (u == null)
            {
                return;
            }
            q      = u.num;
            single = u.single;
            showQuestion();
        };

        MainMenuStrip = menu;
        Controls.Add(menu);
        Controls.Add(singleList);
        Controls.Add(multiList);
        Controls.Add(unSureList);
        Controls.Add(multiLable);
        Controls.Add(singleLable);
        Controls.Add(unSureLabel);
        Controls.Add(time);

        foreach (Choice c in question)
        {
            Controls.Add(c);
        }

        for (int i = 0; i < 30; i++)
        {
            singleList.Items.Add((i + 1) + ". " + paper.single[i].name);
        }
        for (int i = 0; i < 10; i++)
        {
            multiList.Items.Add((i + 1) + ". " + paper.multi[i].name);
        }
        for (int i = 0; i < singleAns.Length; i++)
        {
            singleAns[i] = -1;
        }

        showQuestion();
        timer.Interval = 1000;
        timer.Tick    += delegate { tick(); };
        timer.Start();
    }
    public Exam()
    {
        paper       = new Paper();
        Text        = "模拟考试";
        WindowState = FormWindowState.Maximized;

        MenuStrip         menu         = new MenuStrip();
        ToolStripMenuItem handin       = new ToolStripMenuItem("交卷", null, delegate { this.handin(); });
        ToolStripMenuItem lastQuestion = new ToolStripMenuItem("上一题", null, delegate { this.lastQuestion(); showQuestion(); });
        ToolStripMenuItem nextQuestion = new ToolStripMenuItem("下一题", null, delegate { this.nextQuestion(); showQuestion(); });
        ToolStripMenuItem autoNext     = new ToolStripMenuItem("自动下一题");

        autoNext.Click += delegate
        {
            if (autoNextQuestion)
            {
                autoNext.Text = "不自动下一题";
            }
            else
            {
                autoNext.Text = "自动下一题";
            }
            autoNextQuestion = !autoNextQuestion;
        };

        menu.Items.Add(handin);
        menu.Items.Add(autoNext);
        menu.Items.Add(lastQuestion);
        menu.Items.Add(nextQuestion);

        question[4] = new Choice(4, "", new Rectangle(40, 40, 900, 200), delegate { mark(); });
        for (int i = 0; i < 4; i++)
        {
            question[i] = new Choice(i, "", new Rectangle(40, 100 * i + 240, 900, 100), click);
        }

        time.ForeColor = Color.Tomato;
        time.Font      = new Font("Consolas", 20, FontStyle.Bold);
        time.Location  = new Point(960, 30);
        time.Size      = new Size(300, 50);

        Font  font        = new Font("Consolas", 10, FontStyle.Bold);
        Label singleLable = new Label();

        singleLable.Font     = font;
        singleLable.Location = new Point(950, 100);
        singleLable.Text     = "单选题";
        singleList.Location  = new Point(950, 120);
        singleList.Font      = font;
        singleList.Size      = new Size(300, 250);

        Label unSureLabel = new Label();

        unSureLabel.Font     = font;
        unSureLabel.Location = new Point(950, 380);
        unSureLabel.Text     = "标记题";
        unSureList.Location  = new Point(950, 400);
        unSureList.Size      = new Size(300, 320);
        unSureList.Font      = new Font("Consolas", 10, FontStyle.Bold);

        singleList.SelectedIndexChanged += delegate { q = singleList.SelectedIndex; showQuestion(); };

        unSureList.SelectedIndexChanged += delegate
        {
            Unsure u = unSureList.SelectedItem as Unsure;
            if (u == null)
            {
                return;
            }
            q = u.num;
            showQuestion();
        };

        MainMenuStrip = menu;
        Controls.Add(menu);
        Controls.Add(singleList);
        Controls.Add(unSureList);
        Controls.Add(singleLable);
        Controls.Add(unSureLabel);
        Controls.Add(time);

        foreach (Choice c in question)
        {
            Controls.Add(c);
        }

        for (int i = 0; i < paper.single.Length; i++)
        {
            singleList.Items.Add((i + 1) + ". " + paper.single[i].str);
        }
        for (int i = 0; i < singleAns.Length; i++)
        {
            singleAns[i] = -1;
        }

        showQuestion();
        timer.Interval = 1000;
        timer.Tick    += delegate { tick(); };
        timer.Start();
    }