else // 否则弹出交卷提示,打开答题结果窗体
{
tmrCostTime.Stop();
MessageBox.Show("时间到了,该交卷了!","提示",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
QuizResultForm quizResultForm = new QuizResultForm();
quizResultForm.MdiParent = this.MdiParent;
quizResultForm.Show();
this.Close();
}
}
3) 题库及试卷管理模块源代码
public partial class QuestionListForm : Form
{
private SqlDataAdapter dataAdapter; // 数据适配器
private DataSet dataSet; // 数据集
public QuestionListForm()
{
InitializeComponent();
}
// 窗体加载时,填充数据集,打印内容
private void QuestionListForm_Load(object sender, EventArgs e)
{
// 查询数据库用的SQL语句
string sql = "select QuestionId,Question,OptionA,OptionB,OptionC,OptionD,Answer,Difficulty,SubjectId from Question";
// 创建数据适配器对象
dataAdapter = new SqlDataAdapter(sql, DBHelper.connection);
// 创建数据集对象
dataSet = new DataSet("MySchool");
// 填充数据集
dataAdapter.Fill(dataSet, "Question");
// 指定DataGridView的数据源
dgvQuestion.DataSource = dataSet.Tables["Question"];
}
private void btnClose_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void btnSave_Click(object sender, EventArgs e)
{ C#高职计算机导论考试系统设计与实现(20):http://www.751com.cn/jisuanji/lunwen_181.html