很久以前写的一段代码感觉比较有意思记录下
一、前面是bmp的图像后面是文字
BOOL bRe = Img.Create(IDB_BITMAP_Chamfer, 50, 8, RGB(255, 0, 0));mComBoxChamfer.SetImageList(&Img);COMBOBOXEXITEM cbexItem;cbexItem.mask = CBEIF_IMAGE | CBEIF_SELECTEDIMAGE | CBEIF_OVERLAY | CBEIF_TEXT;for (int i = 0; i < 8; i++){cbexItem.iItem = i; //项的从零开始的索引。cbexItem.iImage = i; //Normal state image index 图像列表中图像的从零开始的索引cbexItem.iSelectedImage = i ; //Selected state image index 图像列表中图像的从零开始的索引cbexItem.iOverlay = i + 1; // 图像列表中叠加图像的从一开始的索引CString cs = StdDataEnumTool::GetStr_ChamferType(i);cbexItem.pszText = cs.GetBuffer();mComBoxChamfer.InsertItem(&cbexItem);mComBoxChamfer.SetItemHeight(i, 30);}if (mComBoxChamfer.GetCurSel() == CB_ERR){int n = mChamfer.mnChamefer;cbexItem.iItem = n; //IndexcbexItem.iImage = n; //Normal state image indexcbexItem.iSelectedImage = n; //Selected state image indexcbexItem.iOverlay = n + 1;CString cs =GetStr(n);cbexItem.pszText = cs.GetBuffer();bRe = mComBoxChamfer.SetItem(&cbexItem);mComBoxChamfer.SetCurSel(n);}
2、设置下拉combox的展示页长度
Shift + 单机 红框内尖尖 就会显示 可以拉大 设置默认下拉长度