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 _4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if(button1.Text== "开始")
{
button1.Text = "暂停";
timer1.Enabled = true;
}
else
{
button1.Text = "开始";
timer1.Enabled = false;
}
}
Random r = new Random();
private void timer1_Tick(object sender, EventArgs e)
{
Thread th1 = new Thread(Random);
Thread th2 = new Thread(Random);
Thread th3 = new Thread(Random);
th1.IsBackground = true;
th2.IsBackground = true;
th3.IsBackground = true;
th1.Start(label1.Text);
th2.Start(label2.Text);
th3.Start(label3.Text);
//label1.Text = r.Next(0, 10).ToString();
//label2.Text = r.Next(0, 10).ToString();
//label3.Text = r.Next(0, 10).ToString();
}
public void Random(object s)
{
s = r.Next(0, 10).ToString();
}
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 _4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if(button1.Text== "开始")
{
button1.Text = "暂停";
timer1.Enabled = true;
}
else
{
button1.Text = "开始";
timer1.Enabled = false;
}
}
Random r = new Random();
private void timer1_Tick(object sender, EventArgs e)
{
Thread th1 = new Thread(Random);
Thread th2 = new Thread(Random);
Thread th3 = new Thread(Random);
th1.IsBackground = true;
th2.IsBackground = true;
th3.IsBackground = true;
th1.Start(label1.Text);
th2.Start(label2.Text);
th3.Start(label3.Text);
//label1.Text = r.Next(0, 10).ToString();
//label2.Text = r.Next(0, 10).ToString();
//label3.Text = r.Next(0, 10).ToString();
}
public void Random(object s)
{
s = r.Next(0, 10).ToString();
}