首页 > 代码库 > control.begininvoke

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 = http://www.mamicode.com/ModbusChannel.Value;
              //不应该再doevents,否则会死锁
              //Application.DoEvents();
          }
      }

control.begininvoke