2

これは私が頻繁にやりたいことです。ソリューションエクスプローラーに何百ものソースファイルが表示されてしまい、混乱を招く可能性があるからです。

Visual Studioでこれを行う拡張機能をいくつか見つけましたが、Visual Web Developer 2010 Expressは拡張機能をサポートしていないため、別の解決策を探しています。

どんな提案もありがたく受けました!

編集:質問のタイトルから明らかでない場合は、展開されたサブツリーを非表示にして、親フォルダーを再度開いたときに同じ状態で表示するのではなく、フォルダーを再帰的に折りたたむ必要があります。

4

3 に答える 3

0

このマクロは役に立ちますか?

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
于 2011-08-31T10:11:49.223 に答える
0

フォルダをダブルクリックすると、そのフォルダは折りたたまれますが、クリックしたフォルダ内のフォルダは折りたたまれません。折りたたまれたフォルダー内に隠されているため、クリックしたフォルダー内にそれらのフォルダーが表示されないため、必要ないかもしれません。

于 2011-06-22T08:21:38.567 に答える