/// <summary> /// 属性修改按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUpdateProp_Click(object sender, EventArgs e) { doc_attached_property docp = (doc_attached_property)gridView1.GetFocusedRow(); if (docp == null) { MessageBox.Show("请先选择一列值!"); return; } int location = 0; // 获取选中的行 for (int i = 0; i < this.gridView1.RowCount; i++) { if (this.gridView1.GetRowCellValue(i, this.gridView1.Columns[0]).ToString() == docp.en_name) { docp = (doc_attached_property)this.gridView1.GetRow(i); location = i; } } // 弹出新增属性框 AddDocProperty add = new AddDocProperty(docp); if (DialogResult.OK == add.ShowDialog()) { list[location] = add.docProperty; this.gridDocProperty.DataSource = list; this.gridDocProperty.RefreshDataSource(); } }
/// <summary> /// 添加属性按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddProp_Click(object sender, EventArgs e) { // 弹出新增属性框 AddDocProperty add = new AddDocProperty(); if (DialogResult.OK == add.ShowDialog()) { list.Add(add.docProperty); this.gridDocProperty.DataSource = list; this.gridDocProperty.RefreshDataSource(); } }