几何尺寸与公差论坛

 找回密码
 注册
查看: 2358|回复: 0

如何存储和读取Listbox控件里的各项字符串?

[复制链接]
发表于 2009-1-4 16:25:24 | 显示全部楼层 |阅读模式
如何存储和读取Listbox控件里的各项字符串?
1. 添加行
用   AddString   (LPCTSTR   lpszItem);   给   LixtBox   增加新项,  

    用结构或者链表来存储相应的   Listbox   各项的索引和内容  
        pListBox->AddString(   str   );   

2. 读取行
CListBox::GetText     
  int   GetText(   int   nIndex,   LPTSTR   lpszBuffer   )   const;   
   
  void   GetText(   int   nIndex,   CString&   rString   )   const;  

3. 删除行     
  int   DeleteString(   UINT   nIndex   )删除指定行
  void   ResetContent(   )可以删除列表框中所有行。
4. 插入行     
  int   InsertString(   int   nIndex,   LPCTSTR   lpszItem   )将行插入到指定位置。     
5. 得到行的数量
  通过调用int   GetCount(   )得到当前列表框中行的数量。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-5-20 22:24 , Processed in 0.035450 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表