views:

38

answers:

2

Hi, this may seem like a trivial question but i am wanting to set up some hotkeys in Visual 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 does anyone know how to control window layout from visual studio macros? Or have a better idea of how to do what i want?

+1  A: 

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...)

David
A: 

*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

Brian Schmitt