Winform 公司年会抽奖系统

1,点击开始按钮之后可以随机公司员工的姓名,图像。

2,中奖人员会在列表中显示。

3,关于一等奖,二等奖,三等奖是主持人随机的。

4,效果图展示

 4.1主页图

 4.2抽奖主页

 4.3开始抽奖

 4.4 中奖人名单

 1   private void LuckyForm_Load(object sender, EventArgs e)
 2         {
 3             try
 4             {
 5                 lblset.Text = UserHelper.one.ToString();  //设置名额
 6                 lblcc.Text = readnum(1).ToString();    //抽出名额
 7                 zhongjianglist();//中奖列表
 8 
 9                // 所有图片路径
10                 string path = Application.StartupPath + @"\staff";
11 
12                 //设置抽奖人员
13                 DirectoryInfo dir = new DirectoryInfo(path);
14                 FileInfo[] ff = dir.GetFiles("*.jpg");
15                 i = ff.Length;
16                 pernum = ff.Length;   //总人数
17                 //存放名字的数组
18                UserHelper.sname = new string[i];
19                 int ix = 0;
20                 foreach (FileInfo f in ff)
21                 {
22                    UserHelper.sname[ix] = f.Name.ToString().Substring(0, f.Name.Length - 4);
23                    ilface.Images.Add(f.Name, Image.FromFile(f.FullName));
24                    ix++;
25                 } 
26                 pernum = i;
27 
28                 //加载单项抽出的人数
29                 save = Convert.ToInt32(lblcc.Text);
30                 //加载抽出的总人数
31                 wined = readnum(1) + readnum(2) + readnum(3) + readnum(4) + readnum(5) + readnum(0);
32             }
33             catch (Exception)
34             {
35                 MessageBox.Show("抱歉,启动失败!","系统",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
36                 this.Close();
37             }
38         }  
View Code

若需要源码可以联系我www.jiangyong.net.cn

posted @ 2015-01-21 11:00  Bodyjiang  阅读(2574)  评论(3编辑  收藏  举报