简体   繁体   中英

Visual Studio - Keyboard Shortcut to close Solution Explorer

Ctrl Alt L Opens Solution Explorer in Visual Sutdio.

But I'm unable to close it with the same keyboard shortcut.

As I need to do this often (to get more real estate on the screen), how do you close the Solution Explorer with a keyboard shortcut?

You can create the following command with Visual Commander (language: C#) and assign a shortcut to close Solution Explorer:

public class C : VisualCommanderExt.ICommand
{
    public void Run(EnvDTE80.DTE2 DTE, Microsoft.VisualStudio.Shell.Package package) 
    {
        var serviceProvider = package as System.IServiceProvider;
        var shell = (Microsoft.VisualStudio.Shell.Interop.IVsUIShell)serviceProvider.GetService(typeof(Microsoft.VisualStudio.Shell.Interop.SVsUIShell));
        var SolutionExplorer = new System.Guid(Microsoft.VisualStudio.Shell.Interop.ToolWindowGuids80.SolutionExplorer);
        Microsoft.VisualStudio.Shell.Interop.IVsWindowFrame frame;
        shell.FindToolWindow(0, ref SolutionExplorer, out frame);
        frame.Hide();
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM