本帖最后由 条条大路同罗马 于 2014-6-8 19:51 编辑
如何实现设计图中运行后显示获奖名单的功能
设计页面
具体要用到什么控件,代码怎么写?
C#新手,急求!
拜托各位!
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 快乐大本营抽奖系统
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
string[] namelist = new string[10] { "赵阳", "钱枫", "孙黎", "李志", "周秦", "吴双", "郑丽", "王磊", "蒋杉", "杨晨", };
private void button1_Click(object sender, EventArgs e)
{
timer1.Start();
}
private void button2_Click(object sender, EventArgs e)
{
timer1.Stop();
}
Random r = new Random();
int i = 0;
private void timer1_Tick(object sender, EventArgs e)
{
i = r.Next(0, 10);//产生0到9之间的随机数
lbName.Text = namelist;
}
int daojishi = 10;
private void timer2_Tick(object sender, EventArgs e)
{
lbName.Text = daojishi.ToString();
daojishi--;
if (daojishi == 0)
{
timer2.Stop();
timer1.Start();
}
}
}
}
|