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;
using System.Threading; namespace 摇奖机程序
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
bool b = false;
private void button1_Click(object sender, EventArgs e)
{
if (b == false)
{ b = true;
int num = int.Parse(this.textBox1.Text);
button1.Text = "停止";
Thread th = new Thread(PlayGame);
th.IsBackground = true;
th.Name = "新线程";
// th.
th.Start(num);
}
else//b==true
{
b = false;
button1.Text = "开始";
}
//PlayGame();
}
private void PlayGame(object ss)
{
Random r = new Random();
while (b)
{
listBox1.Items.Clear();
int num = (int)ss;
for (int i = 0; i < num; i++)
{
//int[] nums = new int[6];
List<int> nums = new List<int>();
for (int j = 0; j < 6; j++)
{
int cu = r.Next(1, 34);
if (nums.Contains(cu))
{
j--;
}
else
{
nums.Add(cu);
}
} nums.Sort();
int lan=r.Next(1,17);
string zu = nums[0].ToString() + " " + nums[1].ToString() + " " + nums[2].ToString() + " " + nums[3].ToString() + " " + nums[4].ToString() + " " + nums[5].ToString() + "-" + lan;
listBox1.Items.Add(zu); } }
} private void Form1_Load(object sender, EventArgs e)
{
Control.CheckForIllegalCrossThreadCalls = false;
} }
}

  

最新文章

  1. 动画在webapp中的现状
  2. 浅谈JavaScript eval() 函数
  3. Linux下使用automake、autoconf生成configure文件
  4. ali笔试总结
  5. 解决SwipeRefreshLayout左右滑动事件冲突的问题
  6. 关于Eclipse中Browser中显示html页面的总结.
  7. 子查询解嵌套in改写为exists
  8. 2.cocos2dx 3.2在语法的差异,lambada使用表达式和function和bind使用功能
  9. jQuery EasyUI的使用入门
  10. iOS9.3越狱
  11. Redis之(三)管理命令
  12. [图论]最大流问题(Maximum flow)的定义
  13. java新知识系列 五
  14. git 出现 fatal: refusing to merge unrelated histories 错误
  15. leetcode 112. Path Sum 、 113. Path Sum II 、437. Path Sum III
  16. buildroot构建项目(八)--- u-boot 2017.11 适配开发板修改 5 ---- 系统启动初始化之五
  17. ksort排序的依据是什么
  18. 008.Zabbix多图展示
  19. java代码Calendar类
  20. Notepad++编译和运行Java

热门文章

  1. NSDictionary
  2. cache与SDRAM
  3. 新建一个Activity通过按钮打开它,再通过按钮关闭它
  4. int和long long有符号整形 负数比正数多一个
  5. Java基础(57):Eclipse中环境配置(视图字体颜色行号调试快捷键等等)
  6. C语言 单引号 双引号问题
  7. cannot modify header information 关于实现widget页面跳转的问题
  8. sql 数据库查看主外键关联
  9. 夺命雷公狗---Thinkphp----15之遍历出来的栏目页的完成
  10. 夺命雷公狗jquery---3普通选择器