private void Form1_Load(object sender, EventArgs e)
{
list.Add("1");
list.Add("2");
list.Add("3");
list.Add("33");
list.Add("399");
list.Add("3668");
list.Add("中国");
list.Add("小扭");
}
添加按钮控件:
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
List<string> list = new List<string>();
private void button1_Click(object sender, EventArgs e)
{
Form2 form = new Form2();
form.list = list;
this.Hide();
form.ShowDialog(this);
}
private void button3_Click(object sender, EventArgs e)
{
if (this.button3.Text == "摇奖开始")
{
button3.Text = "就你了";
timer1.Start();
}
else
{
button3.Text = "摇奖开始";
timer1.Stop();
}
}
添加时间控件:
int index = 0;
private void timer1_Tick(object sender, EventArgs e)
{
if (index == list.Count)
{
index = 0;
}
label1.Text=this.list[index];
textBox1.Text = this.list[index];
index ;
}