For some reason in Visual Studio, one window layout is used, when a window is active in design mode and when a window is active in code mode. There are probably reasons, because you can both open on a part of the screen and this and that ... But I do not use this opportunity and it’s not convenient for me that when I write code, I occupy the properties window and the panel of elements that I need when I I use the designer. Is it possible to set up a studio to automatically hide them when I have a window with a code active, and automatically display when a designer window is active?

PS I have version 2008, the answer is looking for it. But please also leave answers for any version.

  • one
    This can be done using macros. See this question. In newer versions of VS, there are no macros anymore. - Alexander Petrov
  • @AlexanderPetrov, Thank you! Like what you need, but I can not get it to work. What should be done? I copy the code into the EnvironmentEvents module of my MyMacros macro project. And then what? If I figured out how to call up any SUB, then it is not clear that I copied it, saved it, even built it, closed it, closed the studio. And nothing seems to happen, I set breakpoint in the handler, I don’t get it. How to make it work? - 4per
  • one
    Write the code - you can just press Shift + Alt + Enter - go to full screen mode. It is not literally what you are asking for, but very convenient. I don’t remember if studio worked in 2008 (not at hand), in 2015 it works exactly. It seems this is not a Resharper hotkey, but the studio itself. If you have a lot of monitors, it will unfold to the full screen of the current monitor. - AK ♦
  • @AK, well, if not literally! the elements panel and the properties window disappear, and the solution browser remains in the pin-state. This is exactly what I needed, you solved my problem. Please post your comment as answer - 4per

3 answers 3

This is another option: press Shift+Alt+Enter when you go into edit mode code.

This is the standard Studio Hotkey View.FullScreen .

Under the arm of the studio 2015, checked with colleagues in 2012 and 2010 - it works. 2008 is not at hand, but I think that will work too.

  • Yes, it works in 2008. A tick for you, but for the bounty a difficult choice, all the answers are good)) - 4per
  • The competition has come to an end. This answer does not allow you to automatically hide unnecessary windows, but 1) it is the only one that came up to me 2) scored more votes by the time it was completed 3) is very simple to implement, nothing needs to be done 4) fits all versions of studio 5) gets bounty - 4per
  • @ 3per Use on health. In general, I did not expect such a simple recipe to work, at first, I didn’t even want to make a comment. - AK ♦

But please also leave answers for any version.

Starting with Visual Studio “14” CTP 2 : https://blogs.msdn.microsoft.com/visualstudio/2014/07/08/visual-studio-14-ctp-2-available/ , you can save the markup of open windows to IDE.

How to do this is described here: https://msdn.microsoft.com/en-us/library/4k7zyeba.aspx

In short, you arrange the windows as you like and in the top menu choose Window > Save Window Layout . Then you arrange the windows differently as needed and save one more markup. Switch between layouts using the keyboard shortcut: CTRL + ALT + 1..0

Video instruction: https://www.youtube.com/watch?v=IZ4LDZU7c_s

The only negative - this feature is missing in Visual Studio 2008

    In Visual Studio 2005/2008, you can hide and show windows and panels using macros. See this answer. Unfortunately, at the moment I do not have access to previous versions of VS, and there are no macros in new versions.

    I am not eager to install an unnecessary Studio version for me, however I installed the Visual Commander extension (available for versions 2010-2015; it cannot be installed in the Express version). Tested on VS2015 Community.

    After it is installed and the Studio is restarted, the VCmd item will appear in the menu. Select the Extensions item, add a new extension, give it an appropriate name (HideToolboxAndPropertiesPanes), select the C # v4.0 language and enter the following code:

     using EnvDTE; using EnvDTE80; using Microsoft.VisualStudio.Shell; public class E : VisualCommanderExt.IExtension { public void SetSite(DTE2 DTE, Package package) { dte = DTE; windowEvents = DTE.Events.WindowEvents; windowEvents.WindowActivated += OnWindowActivated; } public void Close() { windowEvents.WindowActivated -= OnWindowActivated; } private void OnWindowActivated(Window gotFocus, Window lostFocus) { if (gotFocus.Caption.EndsWith(" [Design]")) { dte.Windows.Item(Constants.vsWindowKindProperties).AutoHides = false; dte.Windows.Item(Constants.vsWindowKindToolbox).AutoHides = false; } else { dte.Windows.Item(Constants.vsWindowKindProperties).AutoHides = true; dte.Windows.Item(Constants.vsWindowKindToolbox).AutoHides = true; } } private DTE2 dte; private WindowEvents windowEvents; } 

    Click on the buttons Compile, Install. Done! Our macro extension is installed. Now the Properties and Toolbox windows are automatically shown when a document is active that contains the string [Design] in the title and is hidden in all other cases.