📄 frmexamtype.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using ExamSystem.BusinessFacade.TopicsFacade;
using ExamSystem.Common.Objects;
using ExamSystem.Common;
namespace StudentsClient
{
/// <summary>
/// FrmExamType 的摘要说明。
/// </summary>
public class FrmExamType : System.Windows.Forms.Form
{
private System.Windows.Forms.Button btnStart;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.GroupBox gpExam;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.NumericUpDown nupTime;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label labHardLevel;
private System.Windows.Forms.NumericUpDown nupLevel5;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.NumericUpDown nupLevel4;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.NumericUpDown nupLevel3;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.NumericUpDown nupLevel2;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.NumericUpDown nupLevel1;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox cmbName;
private System.Windows.Forms.ComboBox cmbCate;
private System.Windows.Forms.Label label3;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
DataSet dsExam;
NumericUpDown[] nums;
private Exam curExam;
public Exam CurExam
{
get
{
return curExam;
}
}
private void fillExam()
{
ExamFac examFac=new ExamFac();
dsExam=examFac.getExam(CommVal.CurrentStu.StuID,-1,"",-1,DateTime.MinValue);
DataRow dr=dsExam.Tables[0].NewRow();
dr["ExamID"]=-1;
dr["ExamName"]="单元测验";
dsExam.Tables[0].Rows.InsertAt(dr,0);
cmbName.DataSource=dsExam.Tables[0];
cmbName.DisplayMember="ExamName";
cmbName.ValueMember="ExamID";
}
private void fillArr()
{
nums=new NumericUpDown[5];
nums[0]=this.nupLevel1;
nums[1]=this.nupLevel2;
nums[2]=this.nupLevel3;
nums[3]=this.nupLevel4;
nums[4]=this.nupLevel5;
for(int i=0;i<nums.Length;i++)
{
nums[i].ValueChanged+=new EventHandler(nupLevel1_ValueChanged);
nums[i].Leave+=new EventHandler(nupLevel1_ValueChanged);
}
}
private void fillCate()
{
CateFac cateFac=new CateFac();
DataSet dsCate=cateFac.getCate(CommVal.CurrentStu.StuClass,"");
DataRow dr=dsCate.Tables[0].NewRow();
// dr["CateID"]=0;
// dr["CateName"]="全部科目";
// dsCate.Tables[0].Rows.InsertAt(dr,0);
cmbCate.DataSource=dsCate.Tables[0];
cmbCate.DisplayMember="CateName";
cmbCate.ValueMember="CateID";
}
private void displayExamInfo()
{
double titleCount=0;//题目总数
double sum=0;//难度总数
for(int i=0;i<this.nums.Length;i++)
{
sum+=Convert.ToDouble((i+1)*nums[i].Value);
titleCount+=Convert.ToDouble(nums[i].Value);
}
double hardLevel=Math.Round(sum/titleCount,2);
this.labHardLevel.Text="难度系数:"+hardLevel.ToString()+"\n题目总数:"+titleCount.ToString();
}
private string getTitles()
{
string resStr="";
for(int i=0;i<this.nums.Length;i++)
{
resStr+=nums[i].Value.ToString();
if(i<nums.Length-1)
{
resStr+=",";
}
}
return resStr;
}
public FrmExamType()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.btnStart = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.gpExam = new System.Windows.Forms.GroupBox();
this.label13 = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label();
this.nupTime = new System.Windows.Forms.NumericUpDown();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.labHardLevel = new System.Windows.Forms.Label();
this.nupLevel5 = new System.Windows.Forms.NumericUpDown();
this.label8 = new System.Windows.Forms.Label();
this.nupLevel4 = new System.Windows.Forms.NumericUpDown();
this.label6 = new System.Windows.Forms.Label();
this.nupLevel3 = new System.Windows.Forms.NumericUpDown();
this.label7 = new System.Windows.Forms.Label();
this.nupLevel2 = new System.Windows.Forms.NumericUpDown();
this.label10 = new System.Windows.Forms.Label();
this.nupLevel1 = new System.Windows.Forms.NumericUpDown();
this.label11 = new System.Windows.Forms.Label();
this.cmbName = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.cmbCate = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.panel1.SuspendLayout();
this.gpExam.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nupTime)).BeginInit();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nupLevel5)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nupLevel4)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nupLevel3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nupLevel2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nupLevel1)).BeginInit();
this.SuspendLayout();
//
// btnStart
//
this.btnStart.Location = new System.Drawing.Point(104, 302);
this.btnStart.Name = "btnStart";
this.btnStart.TabIndex = 44;
this.btnStart.Text = "进入考试";
this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(204, 302);
this.btnCancel.Name = "btnCancel";
this.btnCancel.TabIndex = 44;
this.btnCancel.Text = "取消";
//
// panel1
//
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.cmbName);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(382, 52);
this.panel1.TabIndex = 46;
//
// gpExam
//
this.gpExam.Controls.Add(this.cmbCate);
this.gpExam.Controls.Add(this.label3);
this.gpExam.Controls.Add(this.groupBox1);
this.gpExam.Controls.Add(this.label13);
this.gpExam.Controls.Add(this.label12);
this.gpExam.Controls.Add(this.nupTime);
this.gpExam.Dock = System.Windows.Forms.DockStyle.Top;
this.gpExam.Location = new System.Drawing.Point(0, 52);
this.gpExam.Name = "gpExam";
this.gpExam.Size = new System.Drawing.Size(382, 244);
this.gpExam.TabIndex = 45;
this.gpExam.TabStop = false;
this.gpExam.Text = "考试信息";
//
// label13
//
this.label13.Location = new System.Drawing.Point(300, 36);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(32, 14);
this.label13.TabIndex = 43;
this.label13.Text = "分钟";
//
// label12
//
this.label12.Location = new System.Drawing.Point(208, 36);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -