Esempio n. 1
0
 private void UpdateRowText(DataGridViewRow row, int nameIndex, string text)
 {
     if (this.dgv_doors.InvokeRequired)
     {
         UpdateRowTextCallback cb = new UpdateRowTextCallback(UpdateRowText);
         try
         {
             this.Invoke(cb, new object[] { row, nameIndex, text });
         }
         catch (Exception) { }
     }
     else
     {
         if (row.Cells[nameIndex] != null)
         {
             row.Cells[nameIndex].Value = text;
             Color c = Color.DarkGray;
             if (text == "开")
             {
                 c = Color.Green;
             }
             row.Cells[nameIndex].Style.ForeColor = c;
         }
     }
 }
Esempio n. 2
0
 private void UpdateRowText(DataGridViewRow row, int nameIndex, string text)
 {
     if (this.dgv_doors.InvokeRequired)
     {
         UpdateRowTextCallback cb = new UpdateRowTextCallback(UpdateRowText);
         try
         {
             this.Invoke(cb, new object[] { row, nameIndex, text });
         }
         catch (Exception) { }
     }
     else
     {
         if (row.Cells[nameIndex] != null)
             row.Cells[nameIndex].Value = text;
     }
 }