using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Threading; using System.Transactions; namespace CDCurrentControl.UI { public partial class sdf : Form { public sdf() { InitializeComponent(); } AutoResetEvent are = new AutoResetEvent(true); int i = 0; void aaaa(object ni) { do { this.label1.Text = (i++).ToString(); Thread.Sleep(1000); this.label1.Text = (i++).ToString(); Thread.Sleep(1000); this.label1.Text = (i++).ToString(); Thread.Sleep(1000); this.label1.Text = (i++).ToString(); Thread.Sleep(1000); this.label1.Text = (i++).ToString(); Thread.Sleep(1000); this.label1.Text = (i++).ToString(); Thread.Sleep(1000); this.label1.Text = (i++).ToString();
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;namespace CDCurrentControl.UI
{
public partial class sdf : Form
{
public sdf()
{
InitializeComponent(); } int i = 0; void aaaa()
{
timer1.Interval = 1000;
Thread.Sleep(2000);
i++;
Thread.Sleep(2000);
i++; this.label1.Text = i.ToString();
}
private void button1_Click(object sender, EventArgs e)
{
this.timer1.Enabled = false;
ccca = false;
//this.timer1.Enabled = true;
} private void sdf_Load(object sender, EventArgs e)
{
}
bool ccca = true;
private void timer1_Tick(object sender, EventArgs e)
{
if (ccca == true)
{
aaaa();
}
} }
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.Transactions;
namespace CDCurrentControl.UI
{
public partial class sdf : Form
{
public sdf()
{
InitializeComponent();
}
AutoResetEvent are = new AutoResetEvent(true); int i = 0;
void aaaa(object ni)
{
do
{ this.label1.Text = (i++).ToString();
Thread.Sleep(1000);
this.label1.Text = (i++).ToString();
Thread.Sleep(1000);
this.label1.Text = (i++).ToString();
Thread.Sleep(1000);
this.label1.Text = (i++).ToString();
Thread.Sleep(1000);
this.label1.Text = (i++).ToString();
Thread.Sleep(1000);
this.label1.Text = (i++).ToString();
Thread.Sleep(1000);
this.label1.Text = (i++).ToString();
} while (true);
}
private void button1_Click(object sender, EventArgs e)
{
wocao[0].Suspend();
Thread.Sleep(5000);
wocao[0].Resume(); }
List<Thread> wocao = new List<Thread>();
private void sdf_Load(object sender, EventArgs e)
{
Control.CheckForIllegalCrossThreadCalls = false;
Thread th = new Thread(aaaa);
th.Start(); wocao.Add(th);
} }
}嗯 这样就可以了我怎么这么二呢。。