📄 frmquestion.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;
namespace OES
{
/// <summary>
/// Summary description for frmQuestion.
///
/// </summary>
public class frmQuestion : System.Windows.Forms.Form
{
private System.Windows.Forms.Label lblCreateUser;
private System.Windows.Forms.Label lblSubject;
public System.Windows.Forms.ComboBox cboSubject;
private System.Windows.Forms.TextBox txtQuestionNo;
private System.Windows.Forms.Label lblExamTitle;
private System.Windows.Forms.TextBox txtQuestion;
private System.Windows.Forms.Label lblQuestion;
private System.Windows.Forms.RadioButton radOptionD;
private System.Windows.Forms.RadioButton radOptionC;
private System.Windows.Forms.RadioButton radOptionB;
private System.Windows.Forms.RadioButton radOptionA;
private System.Windows.Forms.GroupBox grpQuestionDetails;
public System.Windows.Forms.Button btnNewSave;
private System.Windows.Forms.Button btnCancel;
private System.ComponentModel.IContainer components=null;
private System.Windows.Forms.TextBox txtOptionA;
private System.Windows.Forms.TextBox txtOptionB;
private System.Windows.Forms.TextBox txtOptionC;
private System.Windows.Forms.TextBox txtOptionD;
//除去private string SubID;
static int localflag;
private string corrAns;
//array of data rows for updation
DataRow drQuestion;
private static int index=0;
private int ans;//stores the last question number of
//a particular subject
private DataTable dtQuestion;
public static DataTable dtUpdate;//stores multiple questions to be updated
string[] searchValue;
//private Question objQ;
private frmQuestionSearch objQSearch;
private System.Windows.Forms.Button btnHelp;
private int questno;
public frmQuestion(int flag)
{
InitializeComponent();
searchValue=new string[1];
localflag=flag;
}
public frmQuestion(int flag, object searchfrm, int qno)
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
objQSearch=(frmQuestionSearch)searchfrm;
questno=qno;
objQSearch.Hide();
searchValue=new string[1];
localflag=flag;
if(localflag == 3)//代表现在是修改状态
{
this.btnNewSave.Enabled=true;
this.btnNewSave.Text = "确认(&O)";
this.lblCreateUser.Location = new System.Drawing.Point(104, 32);
this.lblCreateUser.Text = "修 改 题 库";
//btnCancel.Enabled=true;
//txtQuestionNo.Text="as per search";
frmQuestionSearch.updateflag=true;
btnCancel.Enabled=true;
txtQuestion.ReadOnly=false;
txtOptionA.ReadOnly=false;
txtOptionB.ReadOnly=false;
txtOptionC.ReadOnly=false;
txtOptionD.ReadOnly=false;
cboSubject.Enabled=false;
//除去DataAccess objDA=DataAccess.GetInstance ();
Question objQuestion = new Question();
searchValue[0]=qno.ToString() ;
dtQuestion = objQuestion.FetchQuestions(searchValue);
this.cboSubject.Enabled=false;
this.cboSubject.Text =(String)dtQuestion.Rows[0][1];
this.txtQuestionNo.ReadOnly=true;
this.txtQuestionNo.Text =dtQuestion.Rows[0][2].ToString();
this.txtQuestion.Text =dtQuestion.Rows[0][3].ToString();
this.txtOptionA.Text =dtQuestion.Rows[0][4].ToString();
this.txtOptionB.Text =dtQuestion.Rows[0][5].ToString();
this.txtOptionC.Text =dtQuestion.Rows[0][6].ToString();
this.txtOptionD.Text =dtQuestion.Rows[0][7].ToString();
switch(dtQuestion.Rows[0][8].ToString() )
{
case "A":
radOptionA.Checked=true;
break;
case "B":
radOptionB.Checked=true;
break;
case "C":
radOptionC.Checked=true;
break;
case "D":
radOptionD.Checked=true;
break;
//default:
}
}
else
localflag = 4;
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmQuestion));
this.lblCreateUser = new System.Windows.Forms.Label();
this.lblSubject = new System.Windows.Forms.Label();
this.cboSubject = new System.Windows.Forms.ComboBox();
this.txtQuestionNo = new System.Windows.Forms.TextBox();
this.lblExamTitle = new System.Windows.Forms.Label();
this.txtQuestion = new System.Windows.Forms.TextBox();
this.lblQuestion = new System.Windows.Forms.Label();
this.radOptionD = new System.Windows.Forms.RadioButton();
this.radOptionC = new System.Windows.Forms.RadioButton();
this.radOptionB = new System.Windows.Forms.RadioButton();
this.radOptionA = new System.Windows.Forms.RadioButton();
this.txtOptionA = new System.Windows.Forms.TextBox();
this.txtOptionB = new System.Windows.Forms.TextBox();
this.txtOptionC = new System.Windows.Forms.TextBox();
this.txtOptionD = new System.Windows.Forms.TextBox();
this.grpQuestionDetails = new System.Windows.Forms.GroupBox();
this.btnNewSave = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.btnHelp = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// lblCreateUser
//
this.lblCreateUser.AutoSize = true;
this.lblCreateUser.BackColor = System.Drawing.Color.Transparent;
this.lblCreateUser.Font = new System.Drawing.Font("Century Gothic", 21.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblCreateUser.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(255)));
this.lblCreateUser.Location = new System.Drawing.Point(125, 34);
this.lblCreateUser.Name = "lblCreateUser";
this.lblCreateUser.Size = new System.Drawing.Size(191, 39);
this.lblCreateUser.TabIndex = 9;
this.lblCreateUser.Text = "创 建 题 库";
//
// lblSubject
//
this.lblSubject.AutoSize = true;
this.lblSubject.BackColor = System.Drawing.Color.Transparent;
this.lblSubject.Font = new System.Drawing.Font("Century Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblSubject.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.lblSubject.Location = new System.Drawing.Point(125, 103);
this.lblSubject.Name = "lblSubject";
this.lblSubject.Size = new System.Drawing.Size(32, 18);
this.lblSubject.TabIndex = 35;
this.lblSubject.Text = "科目";
//
// cboSubject
//
this.cboSubject.BackColor = System.Drawing.SystemColors.Info;
this.cboSubject.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboSubject.Items.AddRange(new object[] {
"Java",
"C#",
"SQL Server",
"Html"});
this.cboSubject.Location = new System.Drawing.Point(230, 103);
this.cboSubject.Name = "cboSubject";
this.cboSubject.Size = new System.Drawing.Size(116, 20);
this.cboSubject.TabIndex = 34;
this.cboSubject.SelectedIndexChanged += new System.EventHandler(this.cboSubject_SelectedIndexChanged);
//
// txtQuestionNo
//
this.txtQuestionNo.BackColor = System.Drawing.SystemColors.Info;
this.txtQuestionNo.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.txtQuestionNo.Location = new System.Drawing.Point(230, 146);
this.txtQuestionNo.Name = "txtQuestionNo";
this.txtQuestionNo.ReadOnly = true;
this.txtQuestionNo.Size = new System.Drawing.Size(39, 20);
this.txtQuestionNo.TabIndex = 37;
this.txtQuestionNo.Text = "";
//
// lblExamTitle
//
this.lblExamTitle.AutoSize = true;
this.lblExamTitle.BackColor = System.Drawing.Color.Transparent;
this.lblExamTitle.Font = new System.Drawing.Font("Century Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblExamTitle.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.lblExamTitle.Location = new System.Drawing.Point(125, 146);
this.lblExamTitle.Name = "lblExamTitle";
this.lblExamTitle.Size = new System.Drawing.Size(59, 18);
this.lblExamTitle.TabIndex = 36;
this.lblExamTitle.Text = "试题编号";
this.lblExamTitle.Click += new System.EventHandler(this.lblExamTitle_Click);
//
// txtQuestion
//
this.txtQuestion.AutoSize = false;
this.txtQuestion.BackColor = System.Drawing.SystemColors.Info;
this.txtQuestion.Font = new System.Drawing.Font("Times New Roman", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.txtQuestion.Location = new System.Drawing.Point(259, 207);
this.txtQuestion.Multiline = true;
this.txtQuestion.Name = "txtQuestion";
this.txtQuestion.ReadOnly = true;
this.txtQuestion.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.txtQuestion.Size = new System.Drawing.Size(375, 60);
this.txtQuestion.TabIndex = 38;
this.txtQuestion.Text = "";
//
// lblQuestion
//
this.lblQuestion.AutoSize = true;
this.lblQuestion.BackColor = System.Drawing.Color.Transparent;
this.lblQuestion.Font = new System.Drawing.Font("Century Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblQuestion.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.lblQuestion.Location = new System.Drawing.Point(163, 207);
this.lblQuestion.Name = "lblQuestion";
this.lblQuestion.Size = new System.Drawing.Size(32, 18);
this.lblQuestion.TabIndex = 39;
this.lblQuestion.Text = "试题";
//
// radOptionD
//
this.radOptionD.BackColor = System.Drawing.Color.Transparent;
this.radOptionD.Font = new System.Drawing.Font("Century Gothic", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.radOptionD.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.radOptionD.Location = new System.Drawing.Point(259, 388);
this.radOptionD.Name = "radOptionD";
this.radOptionD.Size = new System.Drawing.Size(48, 26);
this.radOptionD.TabIndex = 44;
this.radOptionD.Text = "D.";
this.radOptionD.CheckedChanged += new System.EventHandler(this.radOptionD_CheckedChanged);
//
// radOptionC
//
this.radOptionC.BackColor = System.Drawing.Color.Transparent;
this.radOptionC.Font = new System.Drawing.Font("Century Gothic", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.radOptionC.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.radOptionC.Location = new System.Drawing.Point(259, 353);
this.radOptionC.Name = "radOptionC";
this.radOptionC.Size = new System.Drawing.Size(48, 26);
this.radOptionC.TabIndex = 43;
this.radOptionC.Text = "C.";
this.radOptionC.CheckedChanged += new System.EventHandler(this.radOptionC_CheckedChanged);
//
// radOptionB
//
this.radOptionB.BackColor = System.Drawing.Color.Transparent;
this.radOptionB.Font = new System.Drawing.Font("Century Gothic", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.radOptionB.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.radOptionB.Location = new System.Drawing.Point(259, 319);
this.radOptionB.Name = "radOptionB";
this.radOptionB.Size = new System.Drawing.Size(48, 26);
this.radOptionB.TabIndex = 42;
this.radOptionB.Text = "B.";
this.radOptionB.CheckedChanged += new System.EventHandler(this.radOptionB_CheckedChanged);
//
// radOptionA
//
this.radOptionA.BackColor = System.Drawing.Color.Transparent;
this.radOptionA.Font = new System.Drawing.Font("Century Gothic", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.radOptionA.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.radOptionA.Location = new System.Drawing.Point(259, 284);
this.radOptionA.Name = "radOptionA";
this.radOptionA.Size = new System.Drawing.Size(48, 26);
this.radOptionA.TabIndex = 41;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -