怎么获取listCtrl中选中行的指定列的值
1个回答
展开全部
CListCtrl::HitTest
int HitTest( LVHITTESTINFO* pHitTestInfo ) const;
int HitTest( CPoint pt, UINT* pFlags = NULL ) const;
海姹网(网址:http://www.seacha.com),标签:CListCtrl怎样获取当前所选中行的index、指定列的值, ClistCtrl,选中,列值
Return Value
The index of the item at the position specified by pHitTestInfo, if any,
海姹网(网址:http://www.seacha.com),标签:CListCtrl怎样获取当前所选中行的index、指定列的值, ClistCtrl,选中,列值
or -1 otherwise.
Parameters
pHitTestInfo
Address of a LVHITTESTINFO structure that contains the position to hit test and that
海姹网(网址:http://www.seacha.com),标签:CListCtrl怎样获取当前所选中行的index、指定列的值, ClistCtrl,选中,列值
receives information about the results of the hit test.
海姹网(网址:http://www.seacha.com),标签:CListCtrl怎样获取当前所选中行的index、指定列的值, ClistCtrl,选中,列值
pt
Point to be tested.
pFlags
Pointer to an integer that receives information about the results of the test. See the
海姹网(网址:http://www.seacha.com),标签:CListCtrl怎样获取当前所选中行的index、指定列的值, ClistCtrl,选中,列值
explanation of the flags member of theLVHITTESTINFO structure in the Platform SDK
获取选择的行
//m_List是要处理的对象
int nItem = m_List.GetNextItem(-1, LVNI_SELECTED);
获取指定行指定列的值
m_List.GetItemText(nItem, nSubItem);
允许多选时,获取选中行进行处理
POSITION pos = m_list.GetFirstSelectedItemPosition();
if (pos == NULL)
{
TRACE0("No items were selected!\n");
}
else
{
while (pos)
{
int nItem = m_list.GetNextSelectedItem(pos);
TRACE1("Item %d was selected!\n", nItem);
// you could do your own processing on nItem here
}
}
int HitTest( LVHITTESTINFO* pHitTestInfo ) const;
int HitTest( CPoint pt, UINT* pFlags = NULL ) const;
海姹网(网址:http://www.seacha.com),标签:CListCtrl怎样获取当前所选中行的index、指定列的值, ClistCtrl,选中,列值
Return Value
The index of the item at the position specified by pHitTestInfo, if any,
海姹网(网址:http://www.seacha.com),标签:CListCtrl怎样获取当前所选中行的index、指定列的值, ClistCtrl,选中,列值
or -1 otherwise.
Parameters
pHitTestInfo
Address of a LVHITTESTINFO structure that contains the position to hit test and that
海姹网(网址:http://www.seacha.com),标签:CListCtrl怎样获取当前所选中行的index、指定列的值, ClistCtrl,选中,列值
receives information about the results of the hit test.
海姹网(网址:http://www.seacha.com),标签:CListCtrl怎样获取当前所选中行的index、指定列的值, ClistCtrl,选中,列值
pt
Point to be tested.
pFlags
Pointer to an integer that receives information about the results of the test. See the
海姹网(网址:http://www.seacha.com),标签:CListCtrl怎样获取当前所选中行的index、指定列的值, ClistCtrl,选中,列值
explanation of the flags member of theLVHITTESTINFO structure in the Platform SDK
获取选择的行
//m_List是要处理的对象
int nItem = m_List.GetNextItem(-1, LVNI_SELECTED);
获取指定行指定列的值
m_List.GetItemText(nItem, nSubItem);
允许多选时,获取选中行进行处理
POSITION pos = m_list.GetFirstSelectedItemPosition();
if (pos == NULL)
{
TRACE0("No items were selected!\n");
}
else
{
while (pos)
{
int nItem = m_list.GetNextSelectedItem(pos);
TRACE1("Item %d was selected!\n", nItem);
// you could do your own processing on nItem here
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询