在ListCtrl中加入COMBO,下列箭頭不會顯示,當點擊ListCtrl單元格時不會顯示,要點擊單元格右端才會顯示,顯然是沒有把COMBO放在最上面,怎麼要調到最上面來呢還有,在運行時怎麼改變COMBO的type值為Drop List,目的是有些時候只能選不能填
下面是相關代碼void CSMG_add::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
Editid=IDC_COMBO1;
LPNMITEMACTIVATE temp=(LPNMITEMACTIVATE)pNMHDR;
CRect wrect,lrect,srect;
this->GetWindowRect(&wrect);
m_list1.GetWindowRect(&lrect);
int x,y;
iRow=temp->iItem;iCol=temp->iSubItem;
m_list1.GetSubItemRect(iRow,iCol,LVIR_BOUNDS,srect);
x=lrect.left-wrect.left;
y=lrect.top-wrect.top;
GetDlgItem(Editid)->SetWindowPos(&wndTop,lrect.left+srect.left-wrect.left,
srect.top+lrect.top-wrect.top-srect.Height(),
srect.right-srect.left-1,srect.Height()-2,NULL); ::Rectangle(::GetDC(temp->hdr.hwndFrom),
srect.left,srect.top-1,srect.right,srect.bottom); getCombox(iCol);//我自己加的,是給COMBO初始化值
str=m_list1.GetItemText(iRow,iCol);
GetDlgItem(Editid)->SetWindowText(str); ::SetFocus(::GetDlgItem(m_hWnd,Editid));
GetDlgItem(Editid)->ShowWindow(SW_SHOW);
*pResult = 0;
}
下面是相關代碼void CSMG_add::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
Editid=IDC_COMBO1;
LPNMITEMACTIVATE temp=(LPNMITEMACTIVATE)pNMHDR;
CRect wrect,lrect,srect;
this->GetWindowRect(&wrect);
m_list1.GetWindowRect(&lrect);
int x,y;
iRow=temp->iItem;iCol=temp->iSubItem;
m_list1.GetSubItemRect(iRow,iCol,LVIR_BOUNDS,srect);
x=lrect.left-wrect.left;
y=lrect.top-wrect.top;
GetDlgItem(Editid)->SetWindowPos(&wndTop,lrect.left+srect.left-wrect.left,
srect.top+lrect.top-wrect.top-srect.Height(),
srect.right-srect.left-1,srect.Height()-2,NULL); ::Rectangle(::GetDC(temp->hdr.hwndFrom),
srect.left,srect.top-1,srect.right,srect.bottom); getCombox(iCol);//我自己加的,是給COMBO初始化值
str=m_list1.GetItemText(iRow,iCol);
GetDlgItem(Editid)->SetWindowText(str); ::SetFocus(::GetDlgItem(m_hWnd,Editid));
GetDlgItem(Editid)->ShowWindow(SW_SHOW);
*pResult = 0;
}
http://www.codeguru.com/Cpp/controls/listview/editingitemsandsubitem/article.php/c979/
加GetDlgItem(Editid)->SetParent(&m_list1);
CBS_SIMPLE
==》
CBS_DROPDOWNLIST
這一行出錯,更改它的属性 ,是不是這樣呀
m_comb.DlgDirSelectComboBoxEx(CBS_SIMPLE);
但也出錯,下面是我找到的文章,我看不明,幫我看看吧
http://www.programfan.com/blog/article.asp?id=1036