MFC CListCtrl 条目取消选中
SetItemState(i, 0, -1);
SetItemState(i, 0, LVIS_SELECTED);
参考:http://blog.csdn.net/tuying_001/article/details/6220753
说明:
MSDN中有以下一段话:
CListCtrl::SetItemState
Parameters
nState
New values for the state bits.
nMask
Mask specifying which state bits to change.
LVITEM Structure
stateMask
Value specifying which bits of the state member will be retrieved or modified. For example, setting this member to LVIS_SELECTED will cause only the item's selection state to be retrieved.
即:stateMask决定哪一个或多个条目风格修改有效; state 为修改后的新值。
This member allows you to modify one or more item states without having to retrieve all of the item states first. For example, setting this member to LVIS_SELECTED and state to zero will cause the item's selection state to be cleared, but none of the other states will be affected.
即:设置stateMask的值为LVIS_SELECTED,并且state 的值设置为0,则条目的选中风格被去除,其他风格将不受影响。
To retrieve or modify all of the states, set this member to (UINT)-1.
即:如果要修改条目所有的风格,只需要将stateMask的值设置为-1.