多线程时,对控件赋值操作

来源:互联网 发布:linux awk 编辑:程序博客网 时间:2024/06/08 12:13

1、禁用button按钮

sB_Move.Invoke(new Action<bool>(p =>{      sB_Move.Enabled = p;}), true);

2、给label赋值

string lbltext = "";lblProgressBar.Invoke(new Action<String>(p =>{     lblProgressBar.Text = p;}), lbltext);

区别就是Action<>看什么类型了,你get了么