当前位置:网站首页>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;
}
}
}
边栏推荐
- 泰山OFFICE技术讲座:英寸,厘米,磅,派卡,提,行,字行,像素的换算关系
- Zhaoqi Kechuang high-quality overseas returnee talent entrepreneurship and innovation service platform, online live broadcast Roadshow
- 开发者如何为React Native选择合适的数据库
- R语言使用gt包和gtExtras包漂亮地显示表格数据:gt_bar_plot函数和gt_plt_bar_pct函数可视化百分比条形图、原始数据的百分比条形、缩放后的数据的百分比条形、指定数据对齐宽度
- [JS advanced] JS regular correlation functions and regular objects_ 02
- MySQL isolation level transactions
- Crazy God redis notes 12
- Data system partition design - Request Routing
- 面试8家公司,1周拿了5个offer,分享一下自己的心得
- Redis distributed lock, it's really impossible without it
猜你喜欢
![Leetcode:6127. Number of high-quality number pairs [bit operation finding rules + the sum of two numbers is greater than or equal to K + dichotomy]](/img/b5/5c7fc70b8025cf7ef21d645a3ac22e.png)
Leetcode:6127. Number of high-quality number pairs [bit operation finding rules + the sum of two numbers is greater than or equal to K + dichotomy]

Geogle colab notes 1-- run the.Py file on the cloud hard disk of Geogle

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

Upgrade esxi6.7.0 to 7.0u3f (updated on July 12, 2022)

tkinter模块高级操作(一)—— 透明按钮、透明文本框、自定义按钮及自定义文本框

Redis distributed lock, it's really impossible without it

Product dynamics - Android 13 high-efficiency adaptation new upgrade

如何构建面向海量数据、高实时要求的企业级OLAP数据引擎?

How matlab saves all the data after running

Boomi荣获“多元化最佳首席执行官奖”和“职业成长最佳公司奖”,在大型公司类别中跻身50强
随机推荐
The second revolution of reporting tools
电阻电路的等效变化(Ⅱ)
Circulaindicator component, which makes the indicator style more diversified
MySQL教程65-MySQL操作表中数据
今天睡眠质量记录84分
Matlab simulation of BPSK modulation system (1)
Pytoch learning notes -- seresnet50 construction
Which led display manufacturer is better
Data system partition design - Request Routing
Data system partition design - partition and secondary index
Permission management - delete menu (recursive)
MySQL-自增锁
mysql 表写锁
Why is preparestatement better and safer?
Upgrade esxi6.7.0 to 7.0u3f (updated on July 12, 2022)
MySQL check whether the table is locked
【IJCAI 2022】参数高效的大模型稀疏训练方法,大幅减少稀疏训练所需资源
行云管家V6.5.1/2/3系列版本发布:数据库OpenAPI能力持续强化
MySQL 元数据锁(MDL)
Reasons for data format conversion when matlab reads the displayed image