c# dataGridview的Cellclick移除事件
private void gvMoldInfo_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 1) return; string colName = gvMoldInfo.Columns[e.ColumnIndex].Name; if (colName != colRemove.Name) return; clsBarcodeMold rec = gvMoldInfo.Rows[e.RowIndex].DataBoundItem as clsBarcodeMold; if (rec == null) return; list.Remove(rec); BindGridView(); }
以上为某dataGridview的cellclick的移除事件,挺好用的,下面为dataGridview的“移除”按钮样式常用设置,注意红框内的意义。