rss· 投稿· 设为首页· 加入收藏· 繁體版
当前位置: 火魔网 » 程序开发 » 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 __2

    public partial class Form1 : Form

    {

        int k = 0, tn = 0;

        string[] StuName = new string[12] { "周玉宾", "001", "002", "003", "004", "005", "006", "007", "008", "009","010","011" };

        public Form1()

        {

            InitializeComponent();

        }

        private void Form1_Load(object sender, EventArgs e)

        {

            timer1.Start();

        }

        private void timer1_Tick(object sender, EventArgs e)

        {

            if (k > 11)

            {

                k = 0;

                label1.Text = StuName[k];

                k++;

            }

            else

            {

                label1.Text = StuName[k];

                k++;

            }

        }

        private void button1_Click(object sender, EventArgs e)

        {

            if (tn == 0)

            {

                timer1.Stop();

                button1.Text = "抽奖";

                tn = 1;

            }

            else if (tn == 1)

            {

                timer1.Start();

                button1.Text = "停止";

                tn = 0;

            }

        }

    }

顶一下
(0)
踩一下
(0)