标签:color lse IV thread this 调用 abort class event
代码如下:
private void ShowMsg(string msg) { if (this.InvokeRequired) { this.Invoke(new Action<string>(ShowMsg), msg); } else { this.txbLog.AppendText(msg); } } private void btnLive_Click(object sender, EventArgs e) { if (this.btnLive.Text == "Live") { islive = true; this.btnLive.Text = "Manual"; thread1 = new Thread(Live); thread1.Start(); } else { islive = false; this.btnLive.Text = "Live"; thread1.Abort(); } } private void Live() { while (islive) { string result="123"; this.ShowMsg(result); Thread.Sleep(500); } }
标签:color lse IV thread this 调用 abort class event
原文地址:https://www.cnblogs.com/kaqiu/p/9155692.html