I have my own implementation of CListCtrl
with checkboxes (LVITEM
) and their sub-items. I can make sub-items disabled but I don't know how to disable checkboxes.
How do I make disabled greyed items in CListCtrl
when the item is LVITEM
?
There is no status for a disabled checkbox.
But you can prevent the status change in LVN_ITEMCHANGING
. This notification is sent before any changes to the list view are applied.
void CWzProjectStatistic_User::OnItemchangingLcData(NMHDR* pNMHDR,LRESULT* pResult)
{
LPNMLISTVIEW pNMLV= reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
// clear result (accept changes)
*pResult = 0;
// Only if the state changes
if ((pNMLV->uNewState&LVIS_STATEIMAGEMASK)!=(pNMLV->uOldState&LVIS_STATEIMAGEMASK))
{
if (IfThisIsADisabledEntry(pMLV))
*pResult = 1;
There is also a chance to implement your own graphic and checkbox handling. You may assign your own imagelist to the list view and you can use your own handling of the state images with LVIS_STATEIMAGEMASK
and INDEXTOSTATEIMAGEMASK