终于解决这个大bug

 

原来c#里面所有其他线程调用的都要加,不加就会卡死

        private delegate void DispMSGDelegate1(string MSG);
        public void setContentText(string txt) {
            if (this.richTextBox1.InvokeRequired == false) //same thread                     
            {
                this.listViewTestItems.Items[currentRow].SubItems[1].Text = txt;
                Thread.Sleep(300);
            }
            else
            {
                DispMSGDelegate1 DMSGD = new DispMSGDelegate1(setContentText);
                this.richTextBox1.Invoke(DMSGD,  txt);
            }
        }
       

 

posted @ 2023-10-25 18:11  cnchengv  阅读(2)  评论(0编辑  收藏  举报