C# 线程中访问控件

C# 线程中访问控件

private void Form1_Load(object sender, EventArgs e)
{
    Thread thread = new Thread(ThreadFuntion);
    thread.IsBackground = true;
    thread.Start();
}

private void ThreadFuntion()
{
    while (true)
    {
        this.textBox1.Text = DateTime.Now.ToString();
        Thread.Sleep(1000);
    }
}
posted @ 2018-04-17 11:38  金领  阅读(161)  评论(0)    收藏  举报