clistctrl失去焦点高亮显示选中行

时间:2021-10-03 05:53:01

clistctrl失去焦点高亮显示选中行

 响应两个消息 NM_SETFOCUS,NM_KILLFOCUS

void CDatabaseParseDlg::OnNMKillfocusListGroup(NMHDR *pNMHDR, LRESULT *pResult)
{
// TODO: Add your control notification handler code here
m_nGroupSel = m_listGroup.GetSelectionMark();
m_listGroup.SetItemState(m_nGroupSel, LVIS_DROPHILITED, LVIS_DROPHILITED);


*pResult = 0;
}


void CDatabaseParseDlg::OnNMSetfocusListGroup(NMHDR *pNMHDR, LRESULT *pResult)
{
// TODO: Add your control notification handler code here
m_listGroup.SetItemState(m_nGroupSel, FALSE, LVIF_STATE);
*pResult = 0;
}

 

LVIS_DROPHILITED  作为一个拖放选项高亮显示
m_listGroup.SetItemState(m_nGroupSel, FALSE, LVIF_STATE);
FALSE表示值,
LVIF_STATE表示修改哪一位