在用线程委托对Windows窗体控件进行操作时,有时需要在线程委托中以参数的形式判断当前线程的执行方式,下面以简单的例子在子线程中以两种方式操作窗体中的TextBox控件。代码如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;//添加线程的命名空间