C#控件多线程更新用委托

  /// <summary>
  /// 関数の方法
  /// </summary>
  delegate void SetGridInitCountCallback();

  /// <summary>
  /// 初期化処理
  /// </summary>
  public void InitGridCount()
  {
   if (this.CommFormPCGrid.InvokeRequired)
   {
    var setListCallback = new SetGridInitCountCallback(InitGridCount);
    this.CommFormPCGrid.Invoke(setListCallback);
   }
   else
   {
    for (int iRow = 0; iRow < this.CommFormPCGrid.Rows.Count; iRow++)
    {
     this.CommFormPCGrid.Rows[iRow].Cells["Count"].Value = 0;
    }
   }
  }

猜你喜欢

转载自blog.csdn.net/ldp365/article/details/49299873