control.begininvoke

void ModbusChannel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
      {
          if (!dgvrChannel.DataGridView.IsHandleCreated)
          {
              return;
          }

          if (dgvrChannel.DataGridView.InvokeRequired)
          {
              dgvrChannel.DataGridView.BeginInvoke(new PropertyChangedEventHandler(ModbusChannel_PropertyChanged), new object[] { sender, e });
          }
          else
          {
              dgvrChannel.Cells["ChannelValue"].Value = ModbusChannel.Value;
              //不应该再doevents,否则会死锁
              //Application.DoEvents();
          }
      }

你可能感兴趣的:(ini)