c# winform多线程实时更新控件

//创建委托        
private delegate void SetTextCallback(string text);
 
   /// <summary>
        /// 控件状态更新
        /// </summary>
        /// <param name="text"></param>
        private void SetText(string text)
        {
            try
            {
                if (txt_RTPPacket.InvokeRequired)
                {
                    SetTextCallback setTextDele = SetText;
                    txt_RTPPacket.Invoke(setTextDele, new object[] { text });
                }
                else
                {
                    txt_RTPPacket.AppendText(text);
                    
                }
            }
            catch (Exception)
            {
            }
        }
原文地址:https://www.cnblogs.com/innershare/p/10607826.html