private void CloseForm(object sender, EventArgs e) { if (MessageBox.Show("确定结束考试吗?", "结束考试", MessageBoxButtons.YesNo) == DialogResult.Yes) { DoneTest Done = new DoneTest(Main.test); Done.Show(); this.Close(); } }
private void DOWN_Click(object sender, EventArgs e) { bool ISChoice = false; foreach (var item in AnswerButton) { if (item.Checked) { ISChoice = true; question.choice = item.Text; if (item.Text == question.Q_RIGHT) { question.right = true; question.Score = question.Q_SCORE; } else { question.right = false; question.Score = 0; } } } if (Main.LEARNMODE && question.ISLearnModeError) { question.choice = question.ErrorAndChoice; question.Score = 0; } if (!ISChoice) { MessageBox.Show("你还没有答题"); return; } if (id == Main.test.Count - 1) { if (Main.LEARNMODE && !question.right) { if (question.ISLearnModeError) { return; } question.ErrorAndChoice = question.choice; Title.ForeColor = Color.Red; string[] Rmchoice = question.Q_RIGHT.Split(','); string tip = "正确答案:\n"; foreach (var Rsingle in Rmchoice) { tip += Rsingle + "\n"; } int line = tip.Split('\n').Length; line += Tools.TextLineValue(tip, 26); Label LearnTip = new Label { Font = new Font("黑体", 12f), Size = new Size(442, 20 + line-- *20), Location = new Point(InitPosX, InitPosY + 70) }; LearnTip.Text = tip; InitPosY += 30; //下一个控件的位置加多少 Controls.Add(LearnTip); this.Size = new Size(this.Size.Width, this.Size.Height + 40 + line * 10); question.ISLearnModeError = true; return; } if (question.ErrorAndNext) { question.choice = question.ErrorAndChoice; } if (question.ISLearnModeError) { question.right = false; question.ErrorAndNext = true; } DoneTest Done = new DoneTest(Main.test); Done.Show(); this.Close(); } else { if (Main.LEARNMODE && !question.right) { if (question.ISLearnModeError) { return; } question.ErrorAndChoice = question.choice; Title.ForeColor = Color.Red; string[] Rmchoice = question.Q_RIGHT.Split(','); string tip = "正确答案:\n"; foreach (var Rsingle in Rmchoice) { tip += Rsingle + "\n"; } int line = tip.Split('\n').Length; line += Tools.TextLineValue(tip, 26); Label LearnTip = new Label { Font = new Font("黑体", 12f), Size = new Size(442, 20 + line-- *20), Location = new Point(InitPosX, InitPosY + 70) }; LearnTip.Text = tip; InitPosY += 30; //下一个控件的位置加多少 Controls.Add(LearnTip); this.Size = new Size(this.Size.Width, this.Size.Height + 40 + line * 10); question.ISLearnModeError = true; return; } if (question.ErrorAndNext) { question.choice = question.ErrorAndChoice; } if (question.ISLearnModeError) { question.right = false; question.ErrorAndNext = true; } Main.test[id + 1].point = this.Location; Main.test[id + 1].Show(); this.Close(); } }