资源描述:
《c#答题测试面板代码》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Data.OleDb;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;namespaceWindowsFormsApplication2{publicpartialclassForm1:Form{publicForm1(){Initial
2、izeComponent();}privatevoidpictureBox1_Click(objectsender,EventArgse){}publicstaticstringkaohao,password;OleDbConnectionconn=newOleDbConnection();OleDbCommandcomm=newOleDbCommand();OleDbDataAdapteradapter=newOleDbDataAdapter();DataSetds=newDataSet();privatevoidForm1_Load(obj
3、ectsender,EventArgse){if(timer1.Enabled==false){timer1.Enabled=true;}}privatevoidbutton1_Click_1(objectsender,EventArgse){kaohao=txthao.Text;password=txtmima.Text;stringconnString="Provider=Microsoft.Jet.OleDb.4.0;DataSource=user.mdb";OleDbConnectionconn=newOleDbConnection(c
4、onnString);stringoledb=string.Format("selectcount(*)from[user]wherekaohao='{0}'andpassword='{1}'",kaohao,password);try{conn.Open();OleDbCommandcomm=newOleDbCommand(oledb,conn);intnum=(int)comm.ExecuteScalar();if(num>0){this.Hide();formform=newform();form.Show();}else{Message
5、Box.Show("考号、密码可能不准确!","登录失败",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);txthao.Text="";txtmima.Text="";txthao.Focus();}}finally{conn.Close();}}privatevoidbutton2_Click(objectsender,EventArgse){this.Close();}privatevoidtexthao_TextChanged(objectsender,EventArgse){}priv
6、atevoidlabel1_Click(objectsender,EventArgse){}privatevoidtimer1_Tick(objectsender,EventArgse){intt;t=label1.Top+label1.Height;label1.Top=label1.Top-2;if(t<0)label1.Location=newPoint(1,125);}}}Form2——考试说明界面作用:考生阅读考试的相关规定,准备答题。所用控件:1个label,1个linklabel,1个checkbox,1个groupbox设计思路
7、:详细内容:属性较特殊的需要说明。代码如下:usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;namespaceWindowsFormsApplication2{publicpartialclassform:Form{publicform(){Initialize
8、Component();}privatevoidForm2_Load(objectsender,EventArgse){lklbl1.Enabled=