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

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

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

2019-11-09 19:51:04
字體:
來源:轉載
供稿:網友
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;        }    }}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 宁城县| 长岛县| 东山县| 武强县| 佛山市| 连云港市| 万荣县| 开远市| 溧阳市| 钟祥市| 黎平县| 广平县| 衢州市| 汝城县| 景洪市| 宜昌市| 太湖县| 北票市| 婺源县| 清水河县| 泰宁县| 建平县| 昌邑市| 凤庆县| 永仁县| 古交市| 株洲县| 儋州市| 隆安县| 深圳市| 张家口市| 华安县| 临邑县| 年辖:市辖区| 潮安县| 平阳县| 武城县| 绩溪县| 晋宁县| 顺昌县| 中宁县|