为什么CComboBox(动态创建)的高度无法调整?
在一个ListView中,创建一100行,
然后想把这100行都变成ComboBox.
为什么ComboBox的高度比ListView中的每一项都大?
即使ComboBox;;SetItemHeight(..);也没有用?
ComboBox.Create(..,rect,..);
那个rect只是指定Combo的所有的可见区域,并不是指定每一项的高度。
怎么才能改变高度?
void CComboInViewView::OnInitialUpdate()
{
CListView::OnInitialUpdate();
int i;
for(i=0; i<100; i++) this->handle[i]=1000+i;
CListCtrl &ct=this->GetListCtrl();
ct.InsertColumn(0,"11",LVCFMT_LEFT,300);
for(i=0; i<100; i++)
ct.InsertItem(i,"ssa");
int j;
for(i=0; i<100; i++)
{
CComboBox* pcb=new CComboBox;
if(!pcb) return ;
this->m_CBList.AddTail(pcb);
LVITEM it;
CRect rect;
it.mask=LVIF_TEXT;
it.iItem=i;
ct.GetItemRect(i,&rect,LVIR_BOUNDS);
rect.right;
rect.bottom+=100;
pcb->Create(WS_CHILD|CBS_DROPDOWNLIST|WS_VSCROLL|WS_HSCROLL,rect,this,this->handle[i]);
CString str;
for(j=0; j<10; j++){
// pcb->SetItemHeight(j,rect.Height());
str.Format("String_(%d,%d)",i,j);
pcb->AddString(str);
}
pcb->ShowWindow(SW_SHOW);
// pcb->Dir(DDL_DIRECTORY,"D:");
}
// cb.ShowDropDown();
// TODO: You may populate your ListView with items by directly accessing
// its list control through a call to GetListCtrl().
}