• 大小: 58KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-19
  • 语言: C#
  • 标签: c#  泛型  面向对象  

资源简介

c#小案例,模拟彩票选号器,程序主要讲解了c#中的面向对象,和泛型的应用,欢迎下载!

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;

namespace selector
{
    public partial class FrmMain : Form
    {
        private List NumList = new List();
        private Selector objSelector = new Selector();
        #region  初始化
        public FrmMain()
        {
            InitializeComponent();
            //禁止按钮
            this.btnPrint.Enabled = false;
            this.btnClear.Enabled = false;
            this.btnDel.Enabled = false;
        }
        #endregion
        //启动选号
        private void btnSingleSelectSuiji_Click(object sender EventArgs e)
        {
            this.timerCreatNum.Start();
            this.btnSingleSelectSuiji.Enabled = false;
        }
        private void timerCreatNum_Tick(object sender EventArgs e)
        {
            string[] numList = objSelector.CreatNums();
            //显示随机 号码
            this.txtSelector1.Text = numList[0];
            this.txtSelector2.Text = numList[1];
            this.txtSelector3.Text = numList[2];
            this.txtSelector4.Text = numList[3];
            this.txtSelector5.Text = numList[4];
            this.txtSelector6.Text = numList[5];
            this.txtSelector7.Text = numList[6]; 
        }
        //开始选号
        private void btnSingleSelect_Click(object sender EventArgs e)
        {
            this.timerCreatNum.Stop();
            string[] selectedNum ={
                                  this.txtSelector1.Text.Trim()
                                  this.txtSelector6.Text.Trim()
                                  this.txtSelector3.Text.Trim()
                                  this.txtSelector4.Text.Trim()
                                  this.txtSelector5.Text.Trim()
                                  this.txtSelector6.Text.Trim()
                                  this.txtSelector7.Text.Trim()
                                  };
            objSelector.SelectNums.Add(selectedNum);
            //显示选中的号码
            this.lbNumList.Items.Clear();
            this.lbNumList.Items.AddRange(this.objSelector.GetPrintNums().ToArray());
            //设置按钮
            this.btnSingleSelectSuiji.Enabled = true;
            this.btnPrint.Enabled = true;
            this.btnClear.Enabled = true;
            this.btnDel.Enabled = true;

        }
        //生成指定组的号码
        private void btnGroupSelect_Click(object sender EventArgs e)       
      {
         
            this.objSelector.CreatGroup(Convert.ToInt32(this.txtGroup.Text.Trim()));
            //显示选中的号码
            this.lbNumList.Items.Clear();
            this.lbNumList.Items.AddRange(this.objSelector.GetPrintNums().ToArray());
            //设置按钮
    

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

     文件        187  2018-05-25 16:22  selector\selector\App.config

     文件        549  2018-05-27 16:42  selector\selector\bin\Debug\SelectNumsList.obj

     文件         25  2018-05-27 17:22  selector\selector\bin\Debug\SelectNumsList.txt

     文件        270  2018-05-30 19:55  selector\selector\bin\Debug\SelectNumsList2.txt

     文件      14848  2018-10-29 21:51  selector\selector\bin\Debug\selector.exe

     文件        187  2018-05-25 16:22  selector\selector\bin\Debug\selector.exe.config

     文件      32256  2018-10-29 21:51  selector\selector\bin\Debug\selector.pdb

     文件      22984  2018-10-29 21:52  selector\selector\bin\Debug\selector.vshost.exe

     文件        187  2018-05-25 16:22  selector\selector\bin\Debug\selector.vshost.exe.config

     文件        490  2018-04-12 07:35  selector\selector\bin\Debug\selector.vshost.exe.manifest

     文件       5103  2018-05-30 20:44  selector\selector\FrmMain.cs

     文件      12115  2018-05-27 15:15  selector\selector\FrmMain.Designer.cs

     文件       6018  2018-05-27 15:15  selector\selector\FrmMain.resx

     文件       3035  2018-05-30 20:44  selector\selector\Models\Selector.cs

     文件       1308  2018-05-27 13:57  selector\selector\obj\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       6899  2018-05-25 16:24  selector\selector\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件        539  2018-10-29 21:52  selector\selector\obj\Debug\selector.csproj.FileListAbsolute.txt

     文件        977  2018-05-27 15:15  selector\selector\obj\Debug\selector.csproj.GenerateResource.Cache

     文件       2209  2018-05-25 17:07  selector\selector\obj\Debug\selector.csprojResolveAssemblyReference.cache

     文件      14848  2018-10-29 21:51  selector\selector\obj\Debug\selector.exe

     文件        180  2018-05-27 15:15  selector\selector\obj\Debug\selector.FrmMain.resources

     文件      32256  2018-10-29 21:51  selector\selector\obj\Debug\selector.pdb

     文件        180  2018-05-25 17:07  selector\selector\obj\Debug\selector.Properties.Resources.resources

     文件          0  2018-05-25 16:22  selector\selector\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs

     文件          0  2018-05-25 16:22  selector\selector\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs

     文件          0  2018-05-25 16:22  selector\selector\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs

     文件        522  2018-05-25 16:23  selector\selector\Program.cs

     文件       1336  2018-05-25 16:22  selector\selector\Properties\AssemblyInfo.cs

     文件       2868  2018-05-25 16:22  selector\selector\Properties\Resources.Designer.cs

     文件       5612  2018-05-25 16:22  selector\selector\Properties\Resources.resx

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

评论

共有 条评论