tree控件----展开树item的函数----CTreeCtrl::Expand
2011-09-20 16:09
405 查看
原来做了个tree控件,用来管理一系列item,可是每次添加item后,需要手动点击“+”号,才能打开树根,看到添加后的结果。就希望在添加一项后,树控件可以自动展开,用到了Expand函数:
BOOL Expand( HTREEITEM hItem, UINT
nCode );
返回值
Nonzero if successful; otherwise 0.
如果成功则返回非零值;否则返回0。
参数说明
hItem
Handle of the tree item being expanded.
要被扩展的tree项的句柄。可以为树根,那么整棵树都被展开。
nCode
A flag indicating the type of action to be taken. This flag can have one of the following values:
用来指示要被进行的动作的标志。这个标志可以是下列值之一:
TVE_COLLAPSE Collapses the list.收缩列表。
TVE_COLLAPSERESET Collapses the list and removes the child items.收缩列表并删除子项。
TVE_EXPAND Expands the list.展开列表。
TVE_TOGGLE Collapses the list if it is currently expanded or expands it if it is currently collapsed.如果列表当前是展开的则收缩列表;反之则展开列表。
备注
Call this function to expand or collapse the list of child items, if any, associated with the given parent item.此成员函数用来展开或收缩给定父项的子项列表(如果有)。
(原文地址:http://www.feiesoft.com/vc/_mfc_ctreectrl.3a3a.expand.htm )
m_ctrlTree.Expand(hRoot,TVE_EXPAND);
//hRoot指定要展开的树根(或子根),参数TVE_EXPAND用来执行展开树hRoot中的所有项。
哈哈!一句话搞定!现在与大家分享一下。
下面把CTreeCtrl::Expand 函数各参数的功能说明如下:BOOL Expand( HTREEITEM hItem, UINT
nCode );
返回值
Nonzero if successful; otherwise 0.
如果成功则返回非零值;否则返回0。
参数说明
hItem
Handle of the tree item being expanded.
要被扩展的tree项的句柄。可以为树根,那么整棵树都被展开。
nCode
A flag indicating the type of action to be taken. This flag can have one of the following values:
用来指示要被进行的动作的标志。这个标志可以是下列值之一:
TVE_COLLAPSE Collapses the list.收缩列表。
TVE_COLLAPSERESET Collapses the list and removes the child items.收缩列表并删除子项。
TVE_EXPAND Expands the list.展开列表。
TVE_TOGGLE Collapses the list if it is currently expanded or expands it if it is currently collapsed.如果列表当前是展开的则收缩列表;反之则展开列表。
备注
Call this function to expand or collapse the list of child items, if any, associated with the given parent item.此成员函数用来展开或收缩给定父项的子项列表(如果有)。
(原文地址:http://www.feiesoft.com/vc/_mfc_ctreectrl.3a3a.expand.htm )
相关文章推荐
- Flex中如何利用expandItem()和expandChildrenOf()展开,或关闭Tree的各层节点
- CListCtrl控件中InsertItem和SetItemText函数及CTreeCtrl::SetItemText
- Flex中如何在Tree控件中指定一个自定义的label函数使其返回的标签名字为叶项目的名称的例子
- 基于Win32 Tree控件实现,支持Item不等高,支持垂直平滑滚动
- Flex:用openItems属性进行Tree控件的展开与关闭
- CListCtrl控件的InsertItem和SetItemText和SetItem三个函数的区别
- 树形控件 CTreeCtrl CViewTree
- flex tree expandItem
- FLEX教程:设置缓动展开TREE控件节点.
- 樹形控件CTreeCtrl添加Item(枝葉)方法
- 利用SubclassDlgItem函数动态连接控件和控件对象
- VC6.0中TreeControl控件点击获取item的名称。
- MFC树控件CTreeCtrl中为每个item节点动态添加提示信息,并定时更新提示内容
- 第三方控件Tree 指定展开多少层的问题
- 利用SubclassDlgItem函数动态连接控件和控件对象
- CTreeCtrl 树状控件显示展开和折叠的按钮“+/-”
- 修改工具栏图标&得到CTreeCtrl控件item的状态为始终为未选中(unchecked)
- Flex的树形控件(Tree Control)中如何通过点击行进行展开/缩进的例子
- [老贴重发]EXT:指定树控件TreePanel 展开到第几层
- 树形控件工具类,实现Tree对象和WebFXTree/WebFXTreeItem的转换