程序代码:
delegate void SafeRefreshCallback(); private void SafeRefresh() { if (this.InvokeRequired) { SafeRefreshCallback d = new SafeRefreshCallback(SafeRefresh); if (!this.Disposing) { try { this.Invoke(d); } catch { }; } } else { this.Refresh(); } }
需要的地方,调用SafeRefresh()就行.