using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace First{ public partial class Form1 : Form { string[] names = System.IO.File.ReadAllLines("names.txt"); Random r = new Random(); public Form1() { InitializeComponent(); } private void button2_Click(object sender, EventArgs e) { this.button1.Visible = true; } private void button1_Click(object sender, EventArgs e) { //string[] names=System.IO.File.ReadAllLines("names.txt"); //Random r = new Random(); //int a = r.Next(names.Length); //this.label1.Text = "中奖的同学是:"+names[a]; if (this.timer1.Enabled) { this.timer1.Enabled = false; } else { this.timer1.Enabled = true; } } private void timer1_Tick(object sender, EventArgs e) { int a = r.Next(names.Length); this.label1.Text = "中奖的同学是:" + names[a]; } }}
目前暂无任何回答
- 0 回答
- 0 关注
- 1143 浏览
添加回答
举报
0/150
提交
取消