展开全部
参考msdn CTreeCtrl::SetCheck BOOL SetCheck( HTREEITEM hItem, BOOL fCheck = TRUE ); Return Value Nonzero if successful; otherwise 0. Parameters hItem The HTREEITEM to receive the check state change. fCheck Indicates whether the tree control item is to be checked or unchecked. By default, SetCheck sets the item to be checked. Remarks Call 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 checkmark. 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); }
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询