在datagridview里填加自定义控件1、定义一个控件如:commbox//定义下拉列表框、隐藏控件、在datagridview中添加控件 private ComboBox datacmb=new ComboBox(); datacmb.Visible = false; this.dataGridView1.Controls.Add(datacmb); 2、添加datagridview的CurrentCellChanged事件private void dataGridView1_CurrentCellChanged(object sender, EventArgs e) { try { if (this.dataGridView1.CurrentCell.ColumnIndex == 4) { Rectangle rec = this.dataGridView1.GetCellDisplayRectangle(dataGridView1.CurrentCell.ColumnIndex, dataGridView1.CurrentCell.RowIndex, false); datacmb.Left = rec.Left; datacmb.Top = rec.Top; datacmb.Width = rec.Width; datacmb.Height = rec.Height; datacmb.Visible = true; } else { datacmb.Visible = false; } } catch { //MessageBox.Show(ex.Message); } }版权声明:本文为wang371756299原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。原文链接:https://blog.csdn.net/wang371756299/article/details/6410040