📄 subject_55476.htm
字号:
<p>
序号:55476 发表者:夏雪宜 发表日期:2003-10-10 10:24:05
<br>主题:如何确定我点的是哪一个列表项
<br>内容:如下图:当我点击名称、类型、大小、可用空间标题栏时,一般的来说可以按照一定的规律对列表中的内容来排序,假如我点击某一标题栏,我想知道我在程序中如何确定我点击的是哪一个标题栏<BR>
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:xiongli 回复日期:2003-10-10 10:32:01
<br>内容:CListBox::GetSel <BR>int GetSel( int nIndex ) const;<BR><BR>Return Value<BR><BR>A positive number if the specified item is selected; otherwise, it is 0. The return value is LB_ERR if an error occurs.<BR><BR>Parameters<BR><BR>nIndex<BR><BR>Specifies the zero-based index of the item.<BR><BR>Remarks<BR><BR>Retrieves the selection state of an item. This member function works with both single- and multiple-selection list boxes.<BR><BR>Example<BR><BR>// The pointer to my list box.<BR>extern CListBox* pmyListBox;<BR><BR>// Dump all of the items select state.<BR>#ifdef _DEBUG<BR> CString str;<BR> for (int i=0;i < pmyListBox->GetCount();i++)<BR> {<BR> str.Format(_T("item %d: select state is %s\r\n"),<BR> i,<BR> pmyListBox->GetSel( i ) > 0 ? _T("true") : _T("false"));<BR> afxDump << str;<BR> }<BR>#endif<BR><BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:夏雪宜 回复日期:2003-10-10 10:43:22
<br>内容:你说的时列表中的数据,我说的是点击列表的标题栏,我要确定点击的是哪一个标题栏,而不是其中的数据。
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:韩广良 回复日期:2003-10-11 22:19:58
<br>内容:响应这个列表控件的LVN_CLUMNCLICK消息,响应函数像这样<BR>void CYourDlg::OnColumnclickList1(NMHDR* pNMHDR, LRESULT* pResult),<BR>在函数中用以下语句就可得到当前点击的列编号nColumnIndex: <BR>NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;<BR>nColumnIndex=pNMListView->iSubItem;<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -