📄 expand_branch.shtml.htm
字号:
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Author" CONTENT="Zafir Anjum">
<META NAME="GENERATOR" CONTENT="Mozilla/4.0 [en] (WinNT; I) [Netscape]">
<TITLE>Expanding a branch</TITLE>
</HEAD>
<body background="../fancyhome/back.gif" tppabs="http://www.codeguru.com/fancyhome/back.gif" bgcolor="#FFFFFF" link="#B50029" vlink="#8E2323" alink="#FF0000" bgproperties="fixed">
<table WIDTH="100%">
<tr WIDTH="100%">
<td><td>
</tr>
</table>
<CENTER>
<H3>
<FONT COLOR="#AOAO99">Expanding a branch</FONT></H3></CENTER>
<CENTER>
<H3>
<HR></H3></CENTER>
The treeview has built in support for expanding expanding the outline one
level at a time. If you want to completely expand a branch, the code below
will help. It uses recursion to expand all items. The last line, that is,
the call to EnsureVisible() is useful when this code is hooked up to a
user interface. After expanding the outline branch, the previously selected
item may have scrolled off and calling EnsureVisible() brings it back.
<BR>
<PRE><TT><FONT COLOR="#990000">// ExpandBranch - Expands a branch completely
// hti - Handle of the tree item to expand
void CTreeCtrlX::ExpandBranch( HTREEITEM hti )
{
if( ItemHasChildren( hti ) ){
Expand( hti, TVE_EXPAND );
hti = GetChildItem( hti );
do{
ExpandBranch( hti );
}while( (hti = GetNextSiblingItem( hti )) != NULL );
}
EnsureVisible( GetSelectedItem() );
}</FONT></TT>
</PRE>
<P>
<HR>
<TABLE BORDER=0 WIDTH="100%" >
<TR>
<TD WIDTH="33%"><FONT SIZE=-1><A HREF="../index.htm" tppabs="http://www.codeguru.com/">Goto HomePage</A></FONT></TD>
<TD WIDTH="33%">
<CENTER><FONT SIZE=-2>© 1997 Zafir Anjum</FONT> </CENTER>
</TD>
<TD WIDTH="34%">
<DIV ALIGN=right><FONT SIZE=-1>Contact me: <A HREF="mailto:zafir@home.com">zafir@home.com</A> </FONT></DIV>
</TD>
</TR>
</TABLE>
<CENTER> <IMG SRC="../cgi/Count.cgi-ft=2&dd=E-df=tv_expand_branch.cnt" tppabs="http://www.codeguru.com/cgi/Count.cgi?ft=2&dd=E%7cdf=tv_expand_branch.cnt" ALIGN="BOTTOM" BORDER="0"></CENTER>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -