代码是这样:
private void dataGridView1_CellEnter(object sender, DataGridViewCellEventArgs e)
{
this.comboBox1.Items.AddRange(new string[] { "a", "b" });
if (e.ColumnIndex ==3 )
{
DataGridViewCell cell = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
Rectangle rec = dataGridView1.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, true);
comboBox1.Top = rec.Top;
comboBox1.Left = rec.Left;
comboBox1.Width = rec.Width;
comboBox1.Height = rec.Height;
//comboBox1.Location = rec.Location;
//this.comboBox1.Size = rec.Size;
comfirmComboxvalue(this.comboBox1, cell.Value.ToString());
comboBox1.BringToFront();
comboBox1.Visible = true;
}
}
不知道为什么不重合?