0

创建新的时Thread,如何传递一个有TextBoxes参数的方法??

private void waits(TextBox t1 ,TextBox t2)
{
    t1.BackColor = Color.Red;
    t2.BackColor = Color.Red;
}

Thread n1=new Thread(waits)
4

1 回答 1

0

使用调用

private void waits(TextBox t1 ,TextBox t2)
{
    t1.Invoke(new Action(()=>
    {
        t1.BackColor = Color.Red;
    });
    t2.Invoke(new Action(()=>
        t2.BackColor =  Color.Red;
    });
}
于 2013-09-15T13:55:13.970 回答