void k_CompilationError(object sender, ErrorEventArgs e) { //listBox2.Items.Clear(); UpdateErrorList update = new UpdateErrorList(UpdateEList); this.Invoke(update, e.Errors); }
//程序和线程中发现错误,显示出来 public void updateErrorList(String s) { if (statusStrip1.InvokeRequired)//如果调用控件的线程和创建创建控件的线程不是同一个则为True { while (!this.statusStrip1.IsHandleCreated) { //解决窗体关闭时出现“访问已释放句柄“的异常 if (this.statusStrip1.Disposing || statusStrip1.IsDisposed) { return; } } UpdateErrorList d = new UpdateErrorList(updateErrorList); this.statusStrip1.Invoke(d, new object[] { s }); } else { statusStrip1.Items[3].Text = s; } }
void k_CompilationError(object sender, ErrorEventArgs e) { UpdateErrorList update = new UpdateErrorList(UpdateEList); this.Invoke(update, e.Errors); }