Thread1.WorkerReportsProgress = true;
Thread1.ProgressChanged += new ProgressChangedEventHandler(Function2HandleWhenProgressChanges); //When progress changes, define a function to handle it.
Thread1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(Function2HandleWhenThreadIsFinished); //The function to run when the thread is finished
Thread1.DoWork += new DoWorkEventHandler(Thread1_DoWorkDo); //The function defining what the thread must do.
现在,我知道 ProgressChangedEventHandler 是一个委托。一个代表,反过来,原来是一个类。
1.“ProgressChangedEventHandler”属于哪个类?我没有在我的代码中定义任何内容。
2. “ProgressChanged”是一个事件吗?如果是这样,它属于哪个类?
3. 如果我没有指定“new ProgressChangedEventHandler”,代码仍然可以编译?像下面的东西。
Thread1.WorkerReportsProgress = true;
Thread1.ProgressChanged += Function2HandleWhenProgressChanges; //When progress changes, define a function to handle it.
Thread1.RunWorkerCompleted += Function2HandleWhenThreadIsFinished; //The function to run when the thread is finished
Thread1.DoWork += Thread1_DoWorkDo; //The function defining what the thread must do.