标签:代码 声明 cat thread spl invoke window oid span
private void DisplayMessageHandler(string strmes, Color color) { label1.Text = strmes; label1.BackColor=color; label1.Refresh(); Application.DoEvents(); }
private void DisplayMessageDelegate(string msg, Color color) { if (this.InvokeRequired) //are we running on a secondary thread { //Make arguments for delegate Object[] args = new Object[] { msg, color }; //Make the delegate DisplayMessage dm = new DisplayMessage(DisplayMessageHandler); this.Invoke(dm,args); } else { DisplayMessageHandler(msg,color); } }
private void OnUpdateWindow(string msg, Color color) { DisplayMessageDelegate(msg, color); }
private delegate void DisplayMessage(string msg, Color color);
public delegate void UpdateWindowDelegate(string msg, Color color ); public static UpdateWindowDelegate UpdateWindow;
private void UpdateMsg(string msg, Color color) { UpdateWindowDelegate uw = UpdateWindow; if (uw != null) UpdateWindow(msg, color); }
Form2.UpdateWindow += new Form2.UpdateWindowDelegate(OnUpdateWindow);
标签:代码 声明 cat thread spl invoke window oid span
原文地址:https://www.cnblogs.com/stoneG/p/8979339.html