How to control VS window positions and state from a macro
I want to set up some hotkeys in Vi开发者_开发百科sual Studio to control the window layout.
For example, F10 would collapse all windows (such as the command from the windows main menu called - Auto Hide All) and then F11 which would dock and position certain windows of my choice at certain positions. This would be so I can jump to specific layouts quickly.
So how to control window layout from visual studio macros?
Probably not optimized but couldn't you consider using vssettings and Import/Export Settings to achieve your goal? (I know this isn't exactly the answer to your question...)
****Update****
You can check out my blog post which provides the ability to list and switch window layouts in Vs2008 and Vs2010: http://www.brianschmitt.com/2010/09/save-and-change-tool-layout-in-visual.html
****Old Answer Below****
If you are looking for a repeatable setup, then a Macro may be your best option. AutoHideAll may already be bound to CTRL+Shift+~ - I cannot remember if that is the default. If not, you can bind it in your Tools-->Options-->Keyboard dialog. In there you can also bind the Macro below to your F11.
Here is a Macro that will accomplish the layout for you:
Public Sub SetupMyPersonalLayout()
DTE.Windows.Item(Constants.vsWindowKindSolutionExplorer).Visible = True
DTE.Windows.Item(Constants.vsWindowKindSolutionExplorer).AutoHides = False
DTE.Windows.Item(Constants.vsWindowKindTaskList).Visible = True
DTE.Windows.Item(Constants.vsWindowKindTaskList).AutoHides = False
End Sub
This will show the window and then "pin" it.
Another option that comes to mind is to take advantage of the different views that Visual Studio offers (Standard, Full Screen, Debug, and some others).
Lastly, if you are on 2005 or earlier (or if you want to update the code) there is an add-in that will do it for you: http://www.codeplex.com/VSWindowManager
精彩评论