创建新的Thread
时,如何传递一个以TextBoxes
作为参数的方法?
private void waits(TextBox t1 ,TextBox t2)
{
t1.BackColor = Color.Red;
t2.BackColor = Color.Red;
}
Thread n1=new Thread(waits)
答案 0 :(得分:0)
使用Invoke
private void waits(TextBox t1 ,TextBox t2)
{
t1.Invoke(new Action(()=>
{
t1.BackColor = Color.Red;
});
t2.Invoke(new Action(()=>
t2.BackColor = Color.Red;
});
}