超级版主
注册日期: 04-03
帖子: 18592
精华: 36
现金: 249466 标准币
资产: 1080358888 标准币
|
如何存储和读取Listbox控件里的各项字符串?
如何存储和读取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( )得到当前列表框中行的数量。
__________________
借用达朗贝尔的名言:前进吧,你会得到信心!
[url="http://www.dimcax.com"]几何尺寸与公差标准[/url]
|