日期:2014-05-20  浏览次数:20877 次

高分?解决立即结分!
我用以下代码来设置将一个COMBOBOX控件放置到DATAGRIDVIEW控件的一个单元格上,但是发现位置的高度不度,从显示效果上看LEFT、WIDTH都是正确的,就是TOP和HEIGHT返回的不对,不能和单元格重合。
Rectangle   rect   =   this.dataGridView1.GetCellDisplayRectangle(this.dataGridView1.CurrentCell.ColumnIndex,   this.dataGridView1.CurrentCell.RowIndex,true);                                           this.comDW.Left   =   rect.Left;
this.comDW.Top   =   rect.Top;
this.comDW.Width   =   rect.Width;
this.comDW.Height   =   rect.Height;
this.comDW.Visible   =   true;


------解决方案--------------------
Column你可以
将ColumnType设置为DataGridViewComboBoxColumn
这就直接有ComboBox用了(Items里添加项)