Setting the CTreeCtrl Element for Partial State

First I add TVS_EX_PARTIALCHECKBOXES to the extended CTreeCtrl styles:

TreeView_SetExtendedStyle(tree->GetSafeHwnd(), TVS_EX_PARTIALCHECKBOXES, TVS_EX_PARTIALCHECKBOXES);

Now, how can I set any item to this state? Apparently, the documentation does not exist. I guessed that by checking and unmarking the work, changing the image of the state of the element to 1 or 2, I can try my luck with 3:

tree->SetItemState(tree->GetFirstVisibleItem(), INDEXTOSTATEIMAGEMASK(3), TVIS_STATEIMAGEMASK);

Of course, that would be too simple, the image just disappeared.

+3
source share
1 answer

Maybe you need to use tree->SetCheck()instead tree->SetItemState(), try setting the check status to 2.

0
source

Source: https://habr.com/ru/post/1732541/


All Articles