标签:style blog class code java tar
private void button1_Click(object sender, EventArgs e) { Thread thread = new Thread(new ThreadStart(display)); thread.Start(); } private void display() { while (true) { Thread.Sleep(100); this.Invoke(new threadcall(SetText2)); } } int count = 0; public delegate void threadcall(); //threadcall Set = ; private void SetText2() { count++; this.label1.Text = count.ToString(); } private void Form1_FormClosing(object sender, FormClosingEventArgs e) { this.Dispose(); //thread.Abort(); } } }
C#中跨线程的调用的方法--this.invoke,布布扣,bubuko.com
标签:style blog class code java tar
原文地址:http://www.cnblogs.com/axiaostudio/p/3708322.html