Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我像这样以编程方式折叠 TreeView 节点时:treeView1.Nodes[0].Collapse(),所有子节点都折叠在它下面,这真的很烦人。当您手动单击节点以折叠它并且子节点记住它们的折叠/展开状态时,不会发生这种情况。我该如何防止这种情况发生?
使用以下方法:
public void Collapse( bool ignoreChildren )
ignoreChildren 类型:System.Boolean true 使子节点保持当前状态;false 折叠子节点。
请参阅:http: //msdn.microsoft.com/en-us/library/ms161262.aspx