CComboBox m_combo;////.h bool bComboBoxSelected;////.h /////OnCbnSelchangeCombo void CMyDlg::OnCbnSelchangeCombo() { // TODO: Add your control notification handler code here CString filePath = "BackGround\\"; CString fileName; //获得指定序号的文本,序号由GetCurSel()获得用户当前选定的项序号 m_combo.GetLBText(m_combo.GetCurSel(), fileName); if(fileName == "---change background---") { bComboBoxSelected = false; } else { bComboBoxSelected = true; } imagePath = filePath + fileName;// + ".bmp"; //MessageBox(imagePath); } /////OnInitDialog() CString filePath = "BackGround\\*.bmp"; m_combo.Dir(0,filePath);////文件夹下所有.bmp都加入combobox
项目中药用到这个控件,以前没用过,现学现用
做个笔记。。