给CComboBox添加记忆
来源:互联网 发布:origin选择x轴数据 编辑:程序博客网 时间:2024/04/29 03:44
CComboBox m_combo;
CString m_str;
然后定义一个宏定义:
#define SEC_STR "histotry"
接着在你按确定的按钮的点击函数上实现保存起来
UpdateData();
int index=m_combo.FindStringExact(0,m_str);
if(index>=0)
{
m_combo.DeleteString(index);
m_combo.InsertString(0,m_str);
m_combo.SetCurSel(0);
}
else
{
m_combo.InsertString(0,m_str);
}
CWinApp *app=AfxGetApp();
for(int i=0;i<m_combo.GetCount();i++)
{
CString id;
id.Format("%d",i);
CString str;
m_combo.GetLBText(i,str);
app->WriteProfileString(SEC_STR,id,str);
}
然后在你初始化的函数里添加读取功能
CWinApp *app=AfxGetApp();
for(int i=0;i<20;i++)
{
CString str;
str.Format("%d",i);
str=app->GetProfileString(SEC_STR,str,"");
if(!str.IsEmpty())
{
m_combo.AddString(str);
}
else
{
break;
}
}
- 给CComboBox添加记忆
- CComboBox 添加水平滚动条
- CComboBox
- Ccombobox
- CComboBox
- CComboBox
- CComboBox
- MFC---CComboBox控件添加字符串函数InsertString
- MFC工具条CToolBar添加非按钮控件CComboBox
- MFC工具条CToolBar添加非按钮控件CComboBox
- MFC工具条CToolBar添加非按钮控件CComboBox
- MFC CComboBox 添加字符串显示不正确的解决方法
- 记忆方法--给朋友的一封信
- 在CComboBox组合框控件中 使用AddString()函数添加下拉列表项
- CComboBox控件
- CComboBox控件
- CComboBox选中
- CComboBox::SelectString
- 配置管理系统和整体变更系统有什么区别与联系
- Android:Java Native Interface入门
- centos ftp_server 安装
- return check()
- 引入 JPEGCodec;JPEGImageEncoder; 图片处理
- 给CComboBox添加记忆
- free svn repository -- www.assembla.com
- 关于需求与干系人期望及团队合作重要性的经典案例
- C++复习之类继承的控制访问
- 黑马程序员:枚举
- PendingIntent
- F# Windows应用程序模板
- 不能被声明为虚函数的C++函数
- Java won't allow a simple loop such as :while (true)