GetSel函数


请输入要查询的词条内容:

GetSel函数


一、函数作用

检索列表框中的项目是否被选中。

二、函数原型

int GetSel( int nIndex ) const;

nIndex为从0开始的项目编号。

三、函数返回值

如果项目被选中则返回值非o;如果项目未被选中则返回值o;如果出错则返回值为LB_ERR。

四、备注

该成员函数既可用于单选的也可用于多选LlisBox.

如需检索 已选中的列表框的选项可以参考CListBox::GetCurSel函数。

五、示例

// Dump all of the items select state.

CString str;

for (int i=0;i < m_myListBox.GetCount();i++)

{

str.Format(_T("item %d: select state is %s\\r\"),i,m_myListBox.GetSel( i ) > 0 ? _T("true") : _T("false"));

AFXDUMP(str);

}

相关分词: GetSel 函数