💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
<p><span style="font-size:16px;"><strong>Collapse 事件(</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</b> <b>Sub </b><span class="emp"><i>object_</i></span><b>Collapse(ByVal</b> <span class="emp"><i>node</i></span> <b>As Node)</b></p> <p>Collapse 事件的语法包含下面部分:<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>Collapse 事件发生在标准的<span> Click </span>事件之前。<span></span></p> <p>折回一个 <b><span>Node </span></b>有三种方法:其一,设置 <b><span>Node </span></b>对象的 <b><span>Expanded </span></b>属性为 <b><span>False</span></b>;其二,双击 <b><span>Node </span></b>对象;其三,在 <b><span>TreeView </span></b>控件的 <b><span>Style </span></b>属性被设置为包括<span> +/- </span>号图像的样式的情况下,单击<span> +/- </span>号图像。所有这些方法都产生<span> Collapse </span>事件。<span></span></p> <p>这个事件传送对折回的 <b><span>Node </span></b>对象的引用。该引用可使一个操作有效,如以下例子所示:</p> <p><br /> </p> <pre class="prettyprint lang-vb">Private Sub TreeView1_Collapse(ByVal Node As Node) If Node.Index = 1 Then Node.Expanded = True ' Expand the node again. End If End Sub</pre> <p><br /> </p> <h1><br /> </h1>