• 大小: 1.73MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-09-02
  • 语言: C#
  • 标签: C#  考试  系统  

资源简介

C# 项目案例设计 适用于c#初学者,简单易懂,注释详细 带数据库

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace question
{
    public partial class checkForm : Form
    {
        public checkForm()
        {
            InitializeComponent();
        }
        public int counts;
        public string[] answer=new string[20];
        public string[] trueAnswer = new string[20];
        public int index;
        private void checkForm_Load(object sender EventArgs e)
        {
            btnInfo();
            checkAnswer();
        }

        private void btnInfo() {
            int x = 20; int y = 20;
            for (int i = 1; i <= counts;i++ )
            {
                Button btn = new Button();
                btn.Size = new Size(6060);
                btn.Location = new Point(xy);
                btn.Name = i.ToString();
                btn.Text = i + “.“ + “未回答“;
                btn.Tag = i;
                x += 70;
                if(i%5==0){
                    x = 20;
                    y += 70;
                }
                btn.Click += new EventHandler(btn_Click);
                groupBox1.Controls.Add(btn);
            }
        }

        void btn_Click(object sender EventArgs e)
        {
            Button btn = (Button)sender;
            index = Convert.ToInt32(btn.Tag)-1;
            this.Close();
        }

        private void checkAnswer() { 
            int i=0;
            foreach(Control cn in groupBox1.Controls ){
                Button btn = (Button)cn;
                if(answer[i]!=null){
                    btn.Text = (i + 1) + “.“ + answer[i];   
                }
                i++;
            }
        }

        private int chkAnswer() {
            int count = 100;
            for (int i = 0; i < counts;i++ )
            {
                if (answer[i] != trueAnswer[i])
                {
                    count -= 5;
                }
            }
            return count;
            
        }

        private void btnJiaoJuan_Click(object sender EventArgs e)
        {
            int i = chkAnswer();
            DialogResult result = MessageBox.Show(“您的得分为“ + i + “分“ + “||“ + “按确定退出考试系统“);
            if(result==DialogResult.OK){
                Environment.Exit(0);
            }
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        913  2009-01-15 15:28  question\question.sln

    ..A..H.     19968  2009-03-19 09:53  question\question.suo

     文件       5612  2009-01-15 15:24  question\question\Properties\Resources.resx

     文件        249  2009-01-15 15:24  question\question\Properties\Settings.settings

     文件       1176  2009-01-15 15:24  question\question\Properties\AssemblyInfo.cs

     文件       2870  2009-01-15 15:24  question\question\Properties\Resources.Designer.cs

     文件       1091  2009-01-15 15:24  question\question\Properties\Settings.Designer.cs

     文件       7323  2009-01-16 15:01  question\question\questionForm.cs

     文件      17399  2009-01-16 10:37  question\question\questionForm.Designer.cs

     文件       4021  2009-01-15 20:13  question\question\question.csproj

     文件       5632  2005-11-11 22:25  question\question\bin\Debug\question.vshost.exe

     文件      53248  2009-03-18 14:37  question\question\bin\Debug\question.exe

     文件      44544  2009-03-18 14:37  question\question\bin\Debug\question.pdb

     文件        180  2009-01-15 15:28  question\question\obj\Debug\question.Properties.Resources.resources

     文件      10700  2009-01-16 10:37  question\question\obj\Debug\question.questionForm.resources

     文件      10700  2009-01-16 12:22  question\question\obj\Debug\question.selectQuestionForm.resources

     文件      53248  2009-03-18 14:37  question\question\obj\Debug\question.exe

     文件        180  2009-01-16 12:22  question\question\obj\Debug\question.checkForm.resources

     文件       1121  2009-01-16 12:22  question\question\obj\Debug\question.csproj.GenerateResource.Cache

     文件      44544  2009-03-18 14:37  question\question\obj\Debug\question.pdb

     文件        371  2009-03-18 14:37  question\question\obj\question.csproj.FileList.txt

     文件      21312  2009-01-16 10:37  question\question\questionForm.resx

     文件       2669  2009-01-16 12:22  question\question\checkForm.Designer.cs

     文件       1394  2009-01-16 12:22  question\question\selectQuestionForm.cs

     文件       5814  2009-01-16 12:22  question\question\checkForm.resx

     文件       2480  2009-01-16 12:22  question\question\checkForm.cs

     文件       2931  2009-01-16 12:22  question\question\selectQuestionForm.Designer.cs

     文件      21312  2009-01-16 12:22  question\question\selectQuestionForm.resx

     文件        480  2009-01-15 15:47  question\question\Program.cs

     文件        249  2009-01-15 15:48  question\question\question.csproj.user

............此处省略15个文件信息

评论

共有 条评论