1、列的ColumnType选择:DataGridViewComboBoxColumn;
2、表格的属性EditMode设置为EditOnEnter;
3、表格添加EditingControlShowing事件;
4、实现单击一次显示下拉列表框,添加CellEnter事件;
bool isBind = false;//是否已经绑定事件
private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
//判断要处理的DataGridViewComboBoxColumn名称,若符合条件,编辑控件被强制转换为ComboBox以处理,添加SelectedIndexChanged事件
if (this.dataGridView1.CurrentCell.OwningColumn.Name == "Good" && dataGridView1.CurrentCell.RowIndex != -1)
{
System.Windows.Forms.ComboBox cb = (System.Windows.Forms.ComboBox)e.Control;
if (!isBind)
{
cb