CTreeCtrl的用法

 

1.取得或设定项目的信息.

BOOL CTreeCtrl::GetItem(TV_ITEM* pItem);
BOOL CTreeCtrl::SetItem(TV_ITEM* pItem);
BOOL CTreeCtrl::SetItem(HTREEITEM hItem,UINTnMask,LPCTSTR lpszItem,int Image,int nSelectedImage,UINT nState,UINT nStateMask,LPARAME lParam);

2.取得与设定项目的状态

UINT CTreeCtrl::GetItemState(HTREEITEM hItem,UINT sStateMask)const;
BOOL CTree Ctrl::SetItemState(HTREEITEM hItem,UINT nState,UINT nStateMask);

3.取得与设定项目的图形

BOOL CTreeCtrl::GetItemImage(HTREEITEM hItem,int& nImage,int& nSelectedImage)const;
BOOL CTreeCtrl::SetItemImage(HTREEITEM hItem,int nImage,int nSelectedImage);

4. 取得与设定项目的文本

CString CTreeCtrl::GetItemText(HTREEITEM,hItem)const;
BOOL CTreeCtrl::SetItemText(HTREEITEM hItem,LPCTSTR lpszItem);

5. 查询 CTreeCtrl 中项目的个数

UINT CTreeCtrl::GetCount();

6.查询hItem 的父项目的句柄

HTREEITEM CTreeCtrl::GetparenItem(HTREEITEM hItem);

7.查询hItem是否有子项

BOOL CTreeCtrl::ItemHasChildren(HTREEITEM hItem);

8.取得hItem 第一个子项的句柄

HTREEITEM CTreeCtrl::GetChildItem(HTREEITEM hItem);

9.查询排在hItem前后的兄弟项

HTREEITEM CTreeCtrl::GetPrevSiblingItem(HTREEITEM hItem);
HTREEITEM CTreeCtrl::GetNextSiblingItem(HTREEITEM hItem);

10.取得选中项的句柄 取得根项的句柄

HTREEITEM CTreeCtrl::GetSelectedItem();

HTREEITEM CTreeCtrl::GetRootItem();

你可能感兴趣的:(MFC)