基于C#制作考試答題系統(tǒng)
效果展示:
1. 進(jìn)入頁(yè)面:
2. 答題界面:
3. 時(shí)間截止界面:
4. 提交界面:
起始頁(yè)代碼
public partial class Start : Form { public Start() { InitializeComponent(); } private void button2_Click(object sender, EventArgs e) { Application.Exit(); } private void button1_Click(object sender, EventArgs e) { Test t = new Test(); t.Show(); this.Hide(); } }
考試頁(yè)面代碼
public partial class Test : Form { public int currentTime = 0; public int num = 0; public Test() { InitializeComponent(); button2.Visible = false; } private void 視圖ToolStripMenuItem_Click(object sender, EventArgs e) { Start s = new Start(); this.Hide(); s.Show(); } private void groupBox1_Enter(object sender, EventArgs e) { } private void Test_Load(object sender, EventArgs e) { this.timer1.Enabled = true; this.timer1.Interval = 1000; this.timer1.Start(); } private void label2_Click(object sender, EventArgs e) { } private void timer1_Tick(object sender, EventArgs e) { currentTime = Convert.ToInt32(label2.Text); currentTime -= 1; label2.Text = Convert.ToString(currentTime); if(currentTime == 0) { timer1.Stop(); System.Media.SystemSounds.Asterisk.Play(); MessageBox.Show("時(shí)間到!", "提示",MessageBoxButtons.OK,MessageBoxIcon.Information); } } private void label6_Click(object sender, EventArgs e) { } private void label7_Click(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { Check(groupBox1, "?"); Check(groupBox2, "?"); Check(groupBox3, "?"); Check(groupBox4, "?"); Check(groupBox5, "?"); a.Enabled = false; b.Enabled = false; radioButton3.Enabled = false; radioButton4.Enabled = false; radioButton5.Enabled = false; radioButton6.Enabled = false; radioButton7.Enabled = false; radioButton8.Enabled = false; radioButton9.Enabled = false; radioButton10.Enabled = false; label6.Text = Convert.ToString(num); label7.Text = Convert.ToString(num * 20); this.timer1.Stop(); button2.Visible = true; } public void Check(GroupBox s, String db) { foreach(Control D in s.Controls) { if (((RadioButton)D).Checked == true && ((RadioButton)D).Text.Substring(0, 1) == db) { num++; } } } private void button2_Click(object sender, EventArgs e) { label2.Text = "20"; label6.Text = "0"; label7.Text = "0"; this.timer1.Start(); this.timer1.Interval = 1000; Clean(groupBox1); Clean(groupBox2); Clean(groupBox3); Clean(groupBox4); Clean(groupBox5); a.Enabled = true; b.Enabled = true; radioButton3.Enabled = true; radioButton4.Enabled = true; radioButton5.Enabled = true; radioButton6.Enabled = true; radioButton7.Enabled = true; radioButton8.Enabled = true; radioButton9.Enabled = true; radioButton10.Enabled = true; button2.Visible = false; num = 0; } public void Clean(GroupBox s) { foreach(Control D in s.Controls) { if(((RadioButton)D).Checked == true) { ((RadioButton)D).Checked = false; } } } }
有圖標(biāo)的應(yīng)用程序
到此這篇關(guān)于基于C#制作考試答題系統(tǒng)的文章就介紹到這了,更多相關(guān)C#答題系統(tǒng)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
通過(guò)App.xaml理解wpf中的Application類
這篇文章主要介紹了通過(guò)App.xaml理解wpf中的Application類,幫助大家更好的理解和學(xué)習(xí)使用c# wpf,感興趣的朋友可以了解下2021-04-04C#學(xué)習(xí)基礎(chǔ)概念二十五問(wèn)續(xù)2
C#學(xué)習(xí)基礎(chǔ)概念二十五問(wèn)續(xù)2...2007-04-04C#中按引用傳遞與按值傳遞的區(qū)別,以及ref與out關(guān)鍵字的用法詳解
以下是對(duì)C#中按引用傳遞與按值傳遞的區(qū)別,以及ref與out關(guān)鍵字的用法進(jìn)行了詳細(xì)的分析介紹,需要的朋友可以過(guò)來(lái)參考下2013-07-07C#實(shí)現(xiàn)創(chuàng)建,刪除,查找,配置虛擬目錄實(shí)例詳解
這篇文章主要介紹了C#創(chuàng)建,刪除,查找,配置虛擬目錄的方法,以實(shí)例形式較為詳細(xì)的分析了C#針對(duì)虛擬目錄的創(chuàng)建、刪除、查找等相關(guān)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-08-08c#中Winform實(shí)現(xiàn)多線程異步更新UI(進(jìn)度及狀態(tài)信息)
本篇文章主要介紹了c#中Winform實(shí)現(xiàn)多線程異步更新UI(進(jìn)度及狀態(tài)信息) ,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-02-02