Visual Studio窗口管理器
时间:2020-03-06 14:37:14 来源:igfitidea点击:
是否有像这样的VisualStudio2008窗口管理器。我真的很喜欢它,这就是我在VisualStudio2005中使用的所有功能,并且看到它应该在VisualStudio2008中可以工作的地方,但事实并非如此。我已经在许多VisualStudio2008安装上尝试过它,并且它不记得任何设置。我真的很喜欢能够轻松快速地更改窗口布局。现在,我只是手动导入和导出设置,但这不是一个即时过程。
我必须怎么做才能使其正常工作?
解决方案
我们应该通过CodePlex与RW联系。他声称可以在VisualStudio2008中使用它。签出此项目。
以下宏可能会解决问题。我做了上面提到的WindowManager,将其重新编译为可用于VisualStudio2008,但我仍然发现它有点不稳定。另外,我不使用WindowManager中的"自动应用布局"功能,因此这些宏非常适合从双显示器工作模式切换到仅笔记本电脑工作模式。
Sub DualMonitorConfiguration_Save() SaveWindowConfiguration("Dual Monitor Layout") End Sub Sub DualMonitorConfiguration_Load() LoadWindowConfiguration("Dual Monitor Layout") End Sub Sub LaptopOnlyConfiguration_Save() SaveWindowConfiguration("Laptop Only Layout") End Sub Sub LaptopOnlyConfiguration_Load() LoadWindowConfiguration("Laptop Only Layout") End Sub Private Sub SaveWindowConfiguration(ByVal configName As String) Dim selectedConfig As WindowConfiguration selectedConfig = FindWindowConfiguration(configName) If selectedConfig Is Nothing Then selectedConfig = DTE.WindowConfigurations.Add(configName) End If selectedConfig.Update() DTE.StatusBar.Text = "Window configuration saved: " & configName End Sub Sub LoadWindowConfiguration(ByVal configName As String) Dim selectedConfig As WindowConfiguration selectedConfig = FindWindowConfiguration(configName) If selectedConfig Is Nothing Then MsgBox("Window Configuration """ & configName & """ not found.") Else selectedConfig.Apply() DTE.StatusBar.Text = "Window configuration applied: " & configName End If End Sub Private Function FindWindowConfiguration(ByVal name As String) As WindowConfiguration Dim selectedLayout As WindowConfiguration For Each config As WindowConfiguration In DTE.WindowConfigurations If config.Name = name Then Return config End If Next Return Nothing End Function
在我们询问问题的同一页上回答了问题:-)
仅作记录:
To get this to work for 2008, add a new HostApplication element to the WindowManager2005.AddIn file. The file is typically found in "%APPDATA%\Microsoft\MSEnvShared\Addins". Change the version in the new element to be 9.0 (VS 2008) and it should work in both 2008 and 2005.
<HostApplication> <Name>Microsoft Visual Studio</Name> <Version>9.0</Version> </HostApplication>
我们可以在Visual Studio中查看我的博客文章"保存和更改工具布局",该列表提供了列出和切换窗口布局的功能。