CTreeCtrl控件中,只想让叶子节点前面才具有复选框,该怎样做呢?
请大家指教!最好是有过这方面实践的高手。

解决方案 »

  1.   

    CTreeCtrl::SetCheck
    BOOL SetCheck( HTREEITEM hItem, BOOL fCheck = TRUE );ResCall this member function to set the check state for a tree control item. When the tree control item is checked (fCheck set to TRUE), the item appears with an adjacent check.Example// The pointer to my tree control.
    extern CTreeCtrl* pmyTreeCtrl;UINT i, uCount = pmyTreeCtrl->GetVisibleCount();
    HTREEITEM hItem = pmyTreeCtrl->GetFirstVisibleItem();// Toggle the check state of all the visible items.
    for (i=0;i < uCount;i++)
    {
       ASSERT(hItem != NULL);
       pmyTreeCtrl->SetCheck(hItem, !pmyTreeCtrl->GetCheck(hItem));
       hItem = pmyTreeCtrl->GetNextVisibleItem(hItem);
    }