private void ReadSetting(object f_path) { if (Setting_dataGridView.InvokeRequired) { ReadSettingCallBack rscb = new ReadSettingCallBack(ReadSetting); Invoke(rscb, new object[] { f_path }); } else { try { int index; Setting_groupBox.Text = String.Format("{0} - {1}", DisplayPrefix, f_path); Sections = OperateIniFile.ReadSections(); foreach (var section in Sections) { index = Setting_dataGridView.Rows.Add(); Setting_dataGridView.Rows[index].Cells[0].Value = section; Setting_dataGridView.Rows[index].ReadOnly = true; Setting_dataGridView.Rows[index].DefaultCellStyle.BackColor = Color.BurlyWood; Setting_dataGridView.Rows[index].Cells[1].Value = TranslateKeys[section]; List <string> Keys = OperateIniFile.ReadKeys(section); foreach (var key in Keys) { index = Setting_dataGridView.Rows.Add(); Setting_dataGridView.Rows[index].Cells[0].Value = key; string Value = Convert.ToString(OperateIniFile.ReadIniData(section, key, "")); Setting_dataGridView.Rows[index].Cells[1].Value = TranslateKeys[key]; Setting_dataGridView.Rows[index].Cells[2].Value = Value; } } } catch (Exception e) { MessageBox.Show(e.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }