是否有某种方法可以在 Visual Web Developer 2010 Express 解决方案资源管理器中递归折叠文件夹?

发布于 2024-11-16 17:37:01 字数 265 浏览 3 评论 0原文

这是我经常想做的事情,因为我最终会在解决方案资源管理器中看到数百个源文件,事情可能会变得非常混乱。

我发现了几个可以在 Visual Studio 中执行此操作的扩展,但由于 Visual Web Developer 2010 Express 不支持扩展,我正在寻找替代解决方案。

如有任何建议,不胜感激!

编辑:如果问题标题不清楚,我想递归地折叠文件夹,而不仅仅是隐藏展开的子树并将其显示在同一文件夹中当我再次打开父文件夹时状态。

This is something I want to do quite often, as I end up with hundreds of source files visible in Solution Explorer and things can get quite confusing.

I have found several extensions which will do this in Visual Studio, but as Visual Web Developer 2010 Express doesn't support extensions I'm looking for an alternative solution.

Any suggestions gratefully received!

Edit: In case it wasn't clear from the question title, I want to collapse folders recursively, not just hide the expanded sub-tree and have it show in the same state when I open the parent folder again.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

月朦胧 2024-11-23 17:37:01

如果双击某个文件夹,该文件夹会折叠,但您单击的文件夹内的文件夹不会折叠。我认为,您可能不需要,因为您看不到您单击的文件夹中的这些文件夹,因为它们隐藏在折叠的文件夹中。

If you double click on a folder, that folder gets collapsed, but not the folders inside the one you clicked. I think, you may not need as you do not get to see those folders inside the one you clicked as they are hidden inside the collapsed folder.

陌生 2024-11-23 17:37:01

这个宏有帮助吗?

http://kylefinley.net/archive/2006/02/02/37.aspx

Imports EnvDTE
Imports System.Diagnostics

Public Module Personal

Sub CollapseAll()

'DESCRIPTION: Collapse all the nodes in the project tree

' Get the the Solution Explorer tree
Dim oSolutionExplorer As UIHierarchy
oSolutionExplorer = DTE.Windows.Item(Constants.vsext_wk_SProjectWindow).Object()

' Check if there is any open solution
If (oSolutionExplorer.UIHierarchyItems.Count = 0) Then
Return
End If

' Get the top node (the name of the solution)
Dim oRootItem As UIHierarchyItem
oRootItem = oSolutionExplorer.UIHierarchyItems.Item(1)
Dim oChildItem As UIHierarchyItem

' Collapse each project node
For Each oChildItem In oRootItem.UIHierarchyItems
CollapseMe(oChildItem, oSolutionExplorer)
Next

' Select the solution node, or else when you click on the solution window
' scrollbar, it will synchronize the open document with the tree and pop
' out the corresponding node which is probably not what you want.
oRootItem.Select(vsUISelectionType.vsUISelectionTypeSelect)

End Sub


Sub CollapseMe(ByVal oRootItem As UIHierarchyItem, ByVal oSolutionExplorer As UIHierarchy)

Dim oChildItem As UIHierarchyItem

For Each oChildItem In oRootItem.UIHierarchyItems
CollapseMe(oChildItem, oSolutionExplorer)
Next

oRootItem.UIHierarchyItems.Expanded = False 

' Added to deal with the Visual Studio bug
If (oRootItem.UIHierarchyItems.Expanded = True) Then
oRootItem.Select(vsUISelectionType.vsUISelectionTypeSelect)
oSolutionExplorer.DoDefaultAction()
End If

End Sub

End Module

does this macro help?

http://kylefinley.net/archive/2006/02/02/37.aspx

Imports EnvDTE
Imports System.Diagnostics

Public Module Personal

Sub CollapseAll()

'DESCRIPTION: Collapse all the nodes in the project tree

' Get the the Solution Explorer tree
Dim oSolutionExplorer As UIHierarchy
oSolutionExplorer = DTE.Windows.Item(Constants.vsext_wk_SProjectWindow).Object()

' Check if there is any open solution
If (oSolutionExplorer.UIHierarchyItems.Count = 0) Then
Return
End If

' Get the top node (the name of the solution)
Dim oRootItem As UIHierarchyItem
oRootItem = oSolutionExplorer.UIHierarchyItems.Item(1)
Dim oChildItem As UIHierarchyItem

' Collapse each project node
For Each oChildItem In oRootItem.UIHierarchyItems
CollapseMe(oChildItem, oSolutionExplorer)
Next

' Select the solution node, or else when you click on the solution window
' scrollbar, it will synchronize the open document with the tree and pop
' out the corresponding node which is probably not what you want.
oRootItem.Select(vsUISelectionType.vsUISelectionTypeSelect)

End Sub


Sub CollapseMe(ByVal oRootItem As UIHierarchyItem, ByVal oSolutionExplorer As UIHierarchy)

Dim oChildItem As UIHierarchyItem

For Each oChildItem In oRootItem.UIHierarchyItems
CollapseMe(oChildItem, oSolutionExplorer)
Next

oRootItem.UIHierarchyItems.Expanded = False 

' Added to deal with the Visual Studio bug
If (oRootItem.UIHierarchyItems.Expanded = True) Then
oRootItem.Select(vsUISelectionType.vsUISelectionTypeSelect)
oSolutionExplorer.DoDefaultAction()
End If

End Sub

End Module
假装不在乎 2024-11-23 17:37:01

好吧,五个月后我假设没有办法做到这一点。标记为已回答。

Ok, after five months I'm assuming there just isn't a way to do this. Marking as answered.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文