//修改功能属性 private void ModifyFunction_Click(object sender, EventArgs e) { Savemode = false; Form3 frm = new Form3("设置功能属性"); frm.Function[0] = dataGridView1.CurrentRow.Cells[0].Value.ToString(); frm.Function[1] = dataGridView1.CurrentRow.Cells[1].Value.ToString(); frm.Function[2] = dataGridView1.CurrentRow.Cells[2].Value.ToString(); frm.Function[3] = dataGridView1.CurrentRow.Cells[3].Value.ToString(); frm.Function[4] = dataGridView1.CurrentRow.Cells[4].Value.ToString(); frm.Attribute = frm.Function; while (true) { frm.ShowDialog(); if (frm.DialogResult == DialogResult.OK) { dataGridView1.CurrentRow.SetValues(frm.Attribute); Savemode = false; } break; } }
//添加功能属性 private void AddFunction_Click(object sender, EventArgs e) { Form3 frm = new Form3( "添加功能属性"); while (true) { frm.ShowDialog(); if (frm.DialogResult == DialogResult.OK) { DataGridViewRowCollection rows = this.dataGridView1.Rows; rows.Add(frm.Attribute[0], frm.Attribute[1], frm.Attribute[2],frm.Attribute[3],frm.Attribute[4]); index2++; Savemode = false; } break; } if (index2 != 0) { ModifyFunction.Enabled = true; DeleteFunction.Enabled = true; } }