2020/05/29

[MFC] TreeCtrl 전체 노드 확장하기

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// 전체 Tree 확장
std::function< void (HTREEITEM) > ldExpand = [&](HTREEITEM hItem)
{
    if ( m_treeLibrary.ItemHasChildren(hItem) )
    {
        m_treeLibrary.Expand( hItem, TVE_EXPAND );
        HTREEITEM hChild = m_treeLibrary.GetChildItem(hItem);
        if ( hItem != nullptr ) ldExpand(hChild);
    }
 
    hItem = m_treeLibrary.GetNextSiblingItem(hItem);
    if ( hItem != nullptr ) ldExpand(hItem);
};
 
HTREEITEM hRootItem = m_treeLibrary.GetRootItem();
ldExpand(hRootItem);