c#考试,答题系统制作(窗体)

考试答题窗体设计


效果展示:

1. 进入页面

c#考试,答题系统制作(窗体)_第1张图片


2. 答题界面:

c#考试,答题系统制作(窗体)_第2张图片


3. 时间截止界面:

c#考试,答题系统制作(窗体)_第3张图片


4. 提交界面:

c#考试,答题系统制作(窗体)_第4张图片


起始页代码

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();            
        }
    }

考试页面代码

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("时间到!", "提示",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;
                }
            }
        }
    }

有图标的应用程序:

在这里插入图片描述

在这里插入图片描述

关注视频号===>学更多网页设计,毕设不是问题

点击前往–》

c#考试,答题系统制作(窗体)_第5张图片

你可能感兴趣的:(笔记,c#,c#,学习,毕设)