📄 frmexamresult.cs
字号:
this.lblPassingScoreVal.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.lblPassingScoreVal.Location = new System.Drawing.Point(408, 208);
this.lblPassingScoreVal.Name = "lblPassingScoreVal";
this.lblPassingScoreVal.Size = new System.Drawing.Size(20, 19);
this.lblPassingScoreVal.TabIndex = 33;
this.lblPassingScoreVal.Text = "60";
//
// lblScoreSecuredVal
//
this.lblScoreSecuredVal.AutoSize = true;
this.lblScoreSecuredVal.BackColor = System.Drawing.Color.Transparent;
this.lblScoreSecuredVal.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.lblScoreSecuredVal.Font = new System.Drawing.Font("Century Gothic", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblScoreSecuredVal.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.lblScoreSecuredVal.Location = new System.Drawing.Point(408, 248);
this.lblScoreSecuredVal.Name = "lblScoreSecuredVal";
this.lblScoreSecuredVal.Size = new System.Drawing.Size(12, 19);
this.lblScoreSecuredVal.TabIndex = 34;
this.lblScoreSecuredVal.Text = "0";
//
// pdocPrint
//
this.pdocPrint.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.pdocPrint_PrintPage);
//
// pdlgPrint
//
this.pdlgPrint.Document = this.pdocPrint;
//
// lblResult
//
this.lblResult.AutoSize = true;
this.lblResult.BackColor = System.Drawing.Color.Transparent;
this.lblResult.Font = new System.Drawing.Font("Century Gothic", 9F);
this.lblResult.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.lblResult.Location = new System.Drawing.Point(240, 288);
this.lblResult.Name = "lblResult";
this.lblResult.Size = new System.Drawing.Size(59, 18);
this.lblResult.TabIndex = 35;
this.lblResult.Text = "考试分数";
//
// lblScore
//
this.lblScore.AutoSize = true;
this.lblScore.BackColor = System.Drawing.Color.Transparent;
this.lblScore.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.lblScore.Font = new System.Drawing.Font("Century Gothic", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblScore.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.lblScore.Location = new System.Drawing.Point(408, 288);
this.lblScore.Name = "lblScore";
this.lblScore.Size = new System.Drawing.Size(12, 19);
this.lblScore.TabIndex = 36;
this.lblScore.Text = "0";
//
// lblPass
//
this.lblPass.AutoSize = true;
this.lblPass.BackColor = System.Drawing.Color.Transparent;
this.lblPass.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.lblPass.Font = new System.Drawing.Font("Century Gothic", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblPass.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.lblPass.Location = new System.Drawing.Point(248, 328);
this.lblPass.Name = "lblPass";
this.lblPass.Size = new System.Drawing.Size(0, 19);
this.lblPass.TabIndex = 38;
//
// frmExamResult
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 13);
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
this.ClientSize = new System.Drawing.Size(653, 483);
this.ControlBox = false;
this.Controls.Add(this.lblPass);
this.Controls.Add(this.lblScore);
this.Controls.Add(this.lblResult);
this.Controls.Add(this.lblScoreSecuredVal);
this.Controls.Add(this.lblPassingScoreVal);
this.Controls.Add(this.lblExamNameVal);
this.Controls.Add(this.lblNameVal);
this.Controls.Add(this.lblScoreSecured);
this.Controls.Add(this.lblPassingScore);
this.Controls.Add(this.lblExamName);
this.Controls.Add(this.lblExamResult);
this.Controls.Add(this.lblName);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.btnPrint);
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Location = new System.Drawing.Point(146, 115);
this.Name = "frmExamResult";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "frmResult";
this.TopMost = true;
this.Load += new System.EventHandler(this.frmExamResult_Load);
this.ResumeLayout(false);
}
#endregion
private void btnExit_Click(object sender, System.EventArgs e)
{
Application.Exit();
}
private void frmExamResult_Load(object sender, System.EventArgs e)
{
objUser=new User();
CreateUserTable();
//assign a string array to pass it to the user class method
string[] str = new string[4];
str[0]="";
str[1]="";
str[2]="";
str[3]=frmLogin.userid;
//accept the datatable returned by FetchRecords
dtUserId=objUser.FetchRecords(str);
lblNameVal.Text=dtUserId.Rows[0]["UsrName"].ToString();
this.lblScoreSecuredVal.Text=this.score.ToString ();
objExam=new Exam();
CreateExamTable();
string[] str1 = new string[4];
str1[0]="";
str1[1]="";
str1[2]=frmExamSchedule.examcode;
str[3]="";
//accept the datatable returned by FetchExamDetails
dtExamTable = objExam.FetchExamDetails(str1);
lblExamNameVal.Text=dtExamTable.Rows[0]["ExamTitle"].ToString();
this.lblScore .Text ="";
this.lblScore .Text =this.intResult .ToString ();
if(this.intResult >=60)
{
this.lblPass .Text ="";
this.lblPass .Text ="恭喜!您通过了考试!";
}
else
{
this.lblPass .Text ="";
this.lblPass .Text ="您没有通过这次考试,请继续努力!";
}
}
public void CreateUserTable()
{
dtUserId = new DataTable("tbl_User");
DataColumn pKeyCol = dtUserId.Columns.Add("UsrId", typeof(String));
pKeyCol.AllowDBNull = false;
pKeyCol.Unique = true;
dtUserId.Columns.Add("UsrName", typeof(String));
}
public void CreateExamTable()
{
dtExamTable = new DataTable("tbl_Exams");
DataColumn pKeyCol = dtExamTable.Columns.Add("ExamCode", typeof(String));
pKeyCol.AllowDBNull = false;
pKeyCol.Unique = true;
dtExamTable.Columns.Add("ExamTitle", typeof(String));
}
private void btnPrint_Click(object sender, System.EventArgs e)
{
if(pdlgPrint.ShowDialog() == DialogResult.OK)
{
pdocPrint.DefaultPageSettings.Landscape=false;
pdlgPrint.Document.Print();
}
}
private void pdocPrint_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
PrinterResolution res=e.PageSettings.PrinterResolution ;
Print_Form(e.Graphics,res.X,res.Y);
}
public void Print_Form(Graphics g, int x, int y)
{
g.FillRectangle (new SolidBrush(this.BackColor),0,0,this.Width,this.Height);
foreach(Control ctrl in Controls)
{
string str=ctrl.GetType().ToString ().Substring (ctrl.GetType ().ToString().LastIndexOf(".")+1);
switch(str)
{
case "Label":
Label lbl=(Label) ctrl;
g.DrawString(lbl.Text,lbl.Font,new SolidBrush(lbl.ForeColor),lbl.Left+lbl.Width/2,lbl.Top+lbl.Height/2-g.MeasureString ("a",lbl.Font).Height/2,new StringFormat());
break;
}
}
}
private void lblScoreSecured_Click(object sender, System.EventArgs e)
{
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -