private void button2_Click(object sender, EventArgs e) { //List<int> ids = new List<int>(); //for (int i = 0; i < dataGridView1.RowCount; i++) //{ // if (dataGridView1.Rows[i].Cells[0].EditedFormattedValue.ToString() == "True") // { // ids.Add(Convert.ToInt32(dataGridView1.Rows[i].Cells["id"].Value)); // } //} if (list_selected.Count == 0) { MessageBox.Show("请至少选择一条数据!", "提示"); return; } else { //parentForm.renderMateriel(ids); MidModule.SendIds(this, list_selected);//发送参数值 if (AddMateriel != null) { AddMateriel(this, new MaterielEventArgs(list_selected)); } this.Close(); } }
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex > -1) { //List<int> ids = new List<int> { Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["id"].Value) }; //parentForm.renderMateriel(ids); if (!args.multi) { AddMateriel(this, new MaterielEventArgs(new List <int> { Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["id"].Value) })); } else { list_selected.Add(Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["id"].Value)); MidModule.SendIds(this, list_selected);//发送参数值 if (AddMateriel != null) { AddMateriel(this, new MaterielEventArgs(list_selected)); } } this.Close(); } }