📄 startanswer.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
namespace Myschool
{
public partial class StartAnswer : Form
{
public static int i = 59, j = 19,s=1,t=0;
public int index = 0;
ArrayList arr = new ArrayList();
AnswerCard ac = new AnswerCard();
public StartAnswer()
{
InitializeComponent();
}
private void StartAnswer_Load(object sender, EventArgs e)
{
t = 0;
arr = Myschool.Select.Title(ExamOnline.sub,QueHelp.allQuestionid[index]);
lblQuestion.Text = "问题" + s;
time.Text = "剩余时间:" + j + ":" + i;
txtque.Text = arr[t].ToString();
radA.Text = "A:" + arr[++t].ToString();
radB.Text = "B:" + arr[++t].ToString();
radC.Text = "C:" + arr[++t].ToString();
radD.Text = "D:" + arr[++t].ToString();
SelectRadButon();
}
//判断选中值的方法
private void SelectedAnswer()
{
if (radA.Checked)
{
QueHelp.studentAnswers[index] = "A";
} if (radB.Checked)
{
QueHelp.studentAnswers[index] = "B";
} if (radC.Checked)
{
QueHelp.studentAnswers[index] = "C";
} if (radD.Checked)
{
QueHelp.studentAnswers[index] = "D";
}
}
/// <summary>
/// 按下一题时把单选按钮清空
/// </summary>
private void SelectRad() {
radA.Checked = false;
radB.Checked = false;
radC.Checked = false;
radD.Checked = false;
}
/// <summary>
/// 判断选中的按钮
/// </summary>
private void SelectRadButon()
{
if (QueHelp.studentAnswers[index].Trim() == "A")
{
radA.Checked = true;
} if (QueHelp.studentAnswers[index].Trim() == "B")
{
radB.Checked = true;
} if (QueHelp.studentAnswers[index].Trim() == "C")
{
radC.Checked = true;
} if (QueHelp.studentAnswers[index].Trim() == "D")
{
radD.Checked = true;
}
}
private void timercol_Tick(object sender, EventArgs e)
{
i--;
if (i == 0) {
i = 59;
j--;
}
time.Text = "剩余时间:" + j + ":" + i;
if (j == 0) {
MessageBox.Show("该交卷了!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
this.Close();
}
}
private void btnnext_Click_1(object sender, EventArgs e)
{
SelectedAnswer();
SelectRad();
index++;
s++;
if (index == QueHelp.allQuestionid.Length) {
ac.MdiParent = MainForm.ActiveForm;
ac.Show();
this.Close();
return;
}
t = 0;
arr = Myschool.Select.Title(ExamOnline.sub, QueHelp.allQuestionid[index]);
lblQuestion.Text = "问题" + s;
if (t==arr.Count) {
ac.MdiParent = MainForm.ActiveForm;
ac.Show();
this.Close();
return;
}
txtque.Text = arr[t].ToString();
radA.Text = "A:" + arr[++t].ToString();
radB.Text = "B:" + arr[++t].ToString();
radC.Text = "C:" + arr[++t].ToString();
radD.Text = "D:" + arr[++t].ToString();
SelectedAnswer();
SelectRadButon();
}
private void btnAnswercard_Click(object sender, EventArgs e)
{
SelectedAnswer();
AnswerCard ac = new AnswerCard();
ac.MdiParent = MainForm.ActiveForm;
ac.Show();
this.Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -