创建线程
Thread th = new Thread(new ThreadStart(test)); //也可简写为new Thread(ThreadMethod); th.Start(); //启动线程线程
PRivate void test() { for (; ; Thread.Sleep(1000)) { SetTextCallback d = new SetTextCallback(SetText); // 托管调用 this.Dispatcher.Invoke(d, new object[] { "需要写进去的内容" }); } }托管调用
delegate void SetTextCallback(string text); private void SetText(string text) { textBox1.Text = text; }
新闻热点
疑难解答