国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

C#/.net學習-13-一個多線程的搖獎winform小程序

2019-11-10 18:15:53
字體:
來源:轉載
供稿:網友
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading;using System.Threading.Tasks;using System.Windows.Forms;namespace _05_搖獎機應用程序{    public partial class Form1 : Form    {        public Form1()        {            InitializeComponent();        }        bool b = false;        PRivate void button1_Click(object sender, EventArgs e)        {            if (b == false)            {                b = true;                button1.Text = "停止";                Thread th = new Thread(PlayGame);                th.IsBackground = true;                th.Name = "新線程";               // th.                th.Start();            }            else//b==true            {                b = false;                button1.Text = "開始";            }            //PlayGame();        }        private void PlayGame()        {            Random r = new Random();            while (b)            {                label1.Text = r.Next(0, 10).ToString();                label2.Text = r.Next(0, 10).ToString();                label3.Text = r.Next(0, 10).ToString();            }        }        private void Form1_Load(object sender, EventArgs e)        {            Control.CheckForIllegalCrossThreadCalls = false;        }    }}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 咸宁市| 北辰区| 木兰县| 临武县| 通州区| 灵台县| 高淳县| 拜泉县| 景宁| 柳州市| 遂溪县| 石楼县| 民权县| 贡嘎县| 襄城县| 宁蒗| 馆陶县| 芜湖县| 仪陇县| 海城市| 漠河县| 安平县| 平定县| 哈密市| 滕州市| 南漳县| 广昌县| 苏尼特右旗| 石河子市| 张家港市| 探索| 山东| 含山县| 舟曲县| 慈溪市| 襄汾县| 洛川县| 揭阳市| 隆安县| 侯马市| 原阳县|