preface:
单击按钮后,实时更改textbox控件值。
解决方法:
- 使用Timer控件
- 新建一个线程实时更新textbox值
多线程下更改非本线程创建的控件:
将引发异常:
System.InvalidOperationException:“线程间操作无效: 从不是创建控件“txtcentgride”的线程访问它。”
原逻辑处理线程:
void readCentigradeThread()
{
while (true)
{
var centigrade