private void ThreadSafeInvoke(Control control, MethodInvoker invoker)
        {
            if (control.InvokeRequired)
            {
                control.Invoke(invoker);
            }
            else
            {
                invoker();
            }
        }

 

调用:匿名方法


            //设置文本
            ThreadSafeInvoke(this,delegate()
            {
                int Cnt = int.Parse(this.listView1.Items[RuleDic[regDetail.SiteID].RowIndex].SubItems[2].Text);
                Cnt++;
                this.listView1.Items[RuleDic[regDetail.SiteID].RowIndex].SubItems[2].Text = Cnt.ToString();

            });

相关文章:

  • 2022-12-23
  • 2021-10-30
  • 2021-07-04
  • 2022-12-23
  • 2021-09-28
  • 2021-04-24
  • 2022-12-23
猜你喜欢
  • 2021-11-19
  • 2022-01-02
  • 2022-12-23
  • 2022-12-23
  • 2021-12-07
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案