向combobox控件中添加元素
2016-01-15 16:36
267 查看
函数定义: bool FillComboBox(CComboBox* pc, CStringList& slValues, bool bOnlyUniqueValues = false); 函数实现: bool FillComboBox(CComboBox* pc, CStringList& slValues, bool bOnlyUniqueValues) { POSITION pos; CString s; pc->ResetContent(); for (pos = slValues.GetHeadPosition(); pos != NULL;) { s = slValues.GetNext(pos); if (bOnlyUniqueValues) { // String already in combobox if (pc->FindStringExact(0, s) != CB_ERR) { continue; } } pc->AddString(s); } return true; }
将字符串列表中的字符串加入combobox控件中,如:
FillComboBox(&m_combobox, strList);
其中m_combobox为combobox控件相关联的变量,strList为CStringList类型,里面保存的是要加入combobox控件中的字符串。
相关文章推荐
- 关注用户体验,实现更多价值
- 绘图
- 交换机MIB浏览器ifType、ifDescr、ifMtu、ifInOctets等的含义
- Android Activity启动模式之singleTask实例详解
- Linux基本命令――优化开机自动加载的服务
- 杨辉三角 C语言
- DB2升级
- DWA算法分析
- List、String、Map相互转换
- 设计模式:开闭原则(OCP)
- hrbustoj 1551 C - 基础数据结构——字符串2 病毒II
- Android特色开发——基于位置的服务
- 分组
- Xcode磁盘空间大清理
- pointer-events:none;
- Jquery map用法
- Studio中导出手机数据库
- 恢复oracle被误更新数据的办法
- Java设计模式——模板方法设计模式——抽象类的运用
- Java利用MessageDigest获取字符串或文件MD5详解