当前位置:网站首页>C# 模拟抽奖
C# 模拟抽奖
2022-07-25 15:56:00 【laocooon】
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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;
Thread thread = new Thread(playGame);
thread.IsBackground = true;
thread.Start();
button1.Text = "停止";
}
else
{
button1.Text = "开始";
b = false;
}
}
private void playGame()
{
Random random = new Random();
while (b)
{
Thread.Sleep(100);
label1.Text = random.Next(1,10).ToString();
label2.Text = random.Next(1, 10).ToString();
label3.Text = random.Next(1, 10).ToString();
}
}
private void Form1_Load(object sender, EventArgs e)
{
Control.CheckForIllegalCrossThreadCalls=false;
}
}
}
边栏推荐
- 推荐收藏,这或许是最全的类别型特征的编码方法总结
- ML - Speech - Introduction to speech processing
- Crazy God redis notes 12
- Alibaba's internal "100 billion level concurrent system architecture design notes" are all inclusive, too comprehensive
- MySQL read / write lock
- 食品安全丨无处不在的冷冻食品,你真的了解吗?
- What is a physical firewall? What's the effect?
- 【莎士比亚:保持做人的乐趣】
- Okaleido上线聚变Mining模式,OKA通证当下产出的唯一方式
- MySQL check whether the table is locked
猜你喜欢

Pytoch learning notes -- seresnet50 construction
![[JS advanced] JS regular correlation functions and regular objects_ 02](/img/a0/27bf3f5146a5774eb3167a69d1e3cf.png)
[JS advanced] JS regular correlation functions and regular objects_ 02

Why is preparestatement better and safer?

Wavelet transform --dwt2 and wavedec2

产品动态丨Android 13 高效适配全新升级

Ml image depth learning and convolution neural network

SVD singular value decomposition derivation and application and signal recovery
![[server data recovery] data recovery cases of raid information loss caused by unexpected power failure of HP EVA server storage](/img/90/51d86111b918eb60761818110cdec4.jpg)
[server data recovery] data recovery cases of raid information loss caused by unexpected power failure of HP EVA server storage

面试突击:为什么 TCP 需要 3 次握手?

Implementation of recommendation system collaborative filtering in spark
随机推荐
Intention lock
Experimental reproduction of image classification (reasoning only) based on caffe resnet-50 network
产品动态丨Android 13 高效适配全新升级
Distributed | practice: smoothly migrate business from MYCAT to dble
SVD singular value decomposition derivation and application and signal recovery
MySQL教程67-使用DISTINCT过滤重复数据
leetcode:154. 寻找旋转排序数组中的最小值 II【关于旋转排序数组的中后定位二分法】
Recursive menu query (recursion: check yourself)
Zhaoqi Kechuang high-level innovation and Entrepreneurship Talent Service Platform at home and abroad, mass entrepreneurship and innovation achievement transformation platform
Typescript learning 1 - data types
PageHelper.startPage没有生效问题
MySQL 元数据锁(MDL)
Mysql读写锁
Copy a word style template to another document
Golang review summary
Baseband simulation system experiment of 4pam in Gaussian channel and Rayleigh channel
leetcode:528. 按权重随机选择【普通随机失效 + 要用前缀和二分】
Record locks
国债年化利率太低了,有比国债逆回购年化利率还要高的理财产品吗?
狂神redis笔记12