ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
<p><span style="font-size:16px;"><strong>Expand 事件(</strong></span><span style="font-size:16px;"><strong>TreeView </strong></span><span style="font-size:16px;"><strong>控件)</strong></span></p> <p><span style="line-height:1.78571;">在 </span><b>TreeView </b><span style="line-height:1.78571;">控件中的 </span><b>Node </b><span style="line-height:1.78571;">对象扩展开时,也就是它的子节点变成可视时,这个事件便发生。</span></p> <p><span></span></p> <p class="label"><b>语法</b></p> <p><b>Private Sub</b> <span class="emp"><i>object_</i></span><b>Expand(ByVal</b> <span class="emp"><i>node</i></span> <b>As Node)</b></p> <p>Expand 事件的语法包含下面部分:<span></span></p> <table class="MsoNormalTable" border="1" cellpadding="0"><tbody><tr><td width="29%" valign="top"><p class="MsoNormal"><b><span style="font-size:9.0pt;font-family:宋体;">部分</span></b><span style="font-size:9.0pt;font-family:宋体;"></span></p> </td> <td width="71%" valign="top"><p class="MsoNormal"><b><span style="font-size:9.0pt;font-family:宋体;">描述</span></b><span style="font-size:9.0pt;font-family:宋体;"></span></p> </td> </tr> <tr><td width="29%" valign="top"><p class="MsoNormal"><span class="emp"><i><span style="font-size:9.0pt;">object</span></i></span><span style="font-size:9.0pt;font-family:宋体;"></span></p> </td> <td width="71%" valign="top"><p class="MsoNormal"><span style="font-size:9.0pt;font-family:宋体;"><span>对象表达式</span></span><span style="font-size:9.0pt;font-family:宋体;">,其值是<span>“</span>应用于<span>”</span>列表中的一个对象。</span><span style="font-size:9.0pt;font-family:宋体;"></span></p> </td> </tr> <tr><td width="29%" valign="top"><p class="MsoNormal"><span class="emp"><i><span style="font-size:9.0pt;">node</span></i></span><span style="font-size:9.0pt;font-family:宋体;"></span></p> </td> <td width="71%" valign="top"><p class="MsoNormal"><span style="font-size:9.0pt;font-family:宋体;">对展开的 <b><span>Node </span></b>对象的引用。</span><span style="font-size:9.0pt;font-family:宋体;"></span></p> </td> </tr> </tbody> </table> <p class="MsoNormal">&nbsp;</p> <p class="label"><b>说明</b></p> <p>Expand 事件发生在<span> Click </span>和<span> DblClick </span>事件之后。<span></span></p> <p>Expand 事件的产生有三种方式:其一,双击带有子节点的 <b><span>Node </span></b>对象;其二,将 <b><span>Node </span></b>对象的 <b><span>Expanded </span></b>属性设置为 <b><span>True</span></b>;其三,单击 +<span>/</span>- 图像。使用<span> Expand </span>事件使一个对象有效,如以下例子所示:</p> <p><br /> </p> <pre class="prettyprint lang-vb">Private Sub TreeView1_Expand(ByVal Node As Node) If Node.Index &lt;&gt; 1 Then Node.Expanded = False '阻止扩展。 End If End Sub</pre> <p><br /> </p>