在窗体的变量定义要增加 private delegate void FillGridDelegate(string[] reader); 要对listboxview初始化 try { this.listView1.Columns.Add("序号"); this.listView1.Columns.Add("频道", 100); this.listView1.Columns.Add("用户名", 150); this.listView1.Columns.Add("聊天类型", 100); this.listView1.Columns.Add("内容", 250); this.listView1.Columns.Add("时间", 120); IntiFontLib(); GetChannelList(); this.timer1.Enabled = false; } catch { } 服务端收到的要这样绑定 try { this.BtnSearch.Enabled = true;//查询按钮使能 this.Cursor = Cursors.Default;//改变鼠标状态 CEnum.Message_Body[,] mResult = (CEnum.Message_Body[,])e.Result; if (mResult[0, 0].eName == CEnum.TagName.ERROR_Msg) { MessageBox.Show(mResult[0, 0].oContent.ToString()); return; } for (int i = mResult.GetLength(0)-1; i >=0; i--) { index++; string[] ListResult ={ mResult[i,0].oContent.ToString(), mResult[i,1].oContent.ToString(), mResult[i,2].oContent.ToString(), mResult[i,3].oContent.ToString(), mResult[i,4].oContent.ToString(), mResult[i,5].oContent.ToString() }; ThreadPool.QueueUserWorkItem(new WaitCallback(RealTimeProcessing), ListResult); Thread.Sleep(20); } } catch (Exception ex) { MessageBox.Show(ex.Message); } 开时间和做代理 #region 处理方法 private void RealTimeProcessing(object state) { try { FillGridDelegate del = new FillGridDelegate(Test); this.Invoke(del, state); Thread.Sleep(20); //Operation_Audition.BuildDataTable(this.m_ClientEvent, mResult, this.dataGridView1, out iPageCount); } catch (Exception ex) { } } private void Test(string[] reader) { try { if (listView1.Items.Count >= 5000) { listView1.Items.Clear(); } ListViewItem aa = new ListViewItem(reader); this.listView1.Items.Insert(0, aa); } catch (Exception ex) { MessageBox.Show(ex.Message); } } #endregion private void timer1_Tick(object sender, EventArgs e) { try { getMsgResult(int.Parse(listView1.Items[0].Text.ToString())); listView1.ListViewItemSorter = new MonkeyListViewItemComparer(); } catch { } }