对WinForm控件取值,牵扯跨线程的问题吗?
比如在非UI线程中取控件值:
bool check = checkBox2.Checked;
这样的语句对吗?
还是说必须:
bool check =true;
checkBox2.Invoke(new Action (() => {
if (checkBox2.Checked==false) check =false;
}));
谢谢!
回答
读取不用跨线程的。
比如在非UI线程中取控件值:
bool check = checkBox2.Checked;
这样的语句对吗?
还是说必须:
bool check =true;
checkBox2.Invoke(new Action (() => {
if (checkBox2.Checked==false) check =false;
}));
谢谢!
读取不用跨线程的。