开发者

How to disable / use Visual Studio's title bar

I would like to use the space wasted by Visual Studio 开发者_C百科2010's title bar.

Is it possible to put the toolbar or the tab bar in the title bar, like Google Chrome?

Can it be done writing an extension?

Thanks


Visual Studio has a full screen mode: View -> Full Screen Mode (or Shift + Alt + Enter, by default).


This seems to not be possible, even with Visual Studio 2012 and Visual Studio 2013.


It seems to be possible, at least in VS2013 (but will probably work also with other versions supported by VisualCommander extension). Here is the needed macro, maybe someone will find it useful:

  1. Hide title bar in Visual Studio 2013.
public class E : VisualCommanderExt.IExtension
{
    public void SetSite(EnvDTE80.DTE2 DTE, Microsoft.VisualStudio.Shell.Package package)
    {
        events = DTE.Events;
        dteEvents = events.DTEEvents;
        dteEvents.OnStartupComplete += OnStartupComplete;
    }
    public void Close()
    {
        dteEvents.OnStartupComplete -= OnStartupComplete;
    }
    private void OnStartupComplete()
    {
        try
        {
            HideTitleBar();
        }
        catch
        {
        }
    }
    private bool HideTitleBar()
    {
        System.Windows.FrameworkElement e = 
            FindElement(System.Windows.Application.Current.MainWindow, 
                "MainWindowTitleBar");
        if (e != null)
        {
            e.Visibility = System.Windows.Visibility.Collapsed;
            return true;
        }
        return false;
    }
    private System.Windows.FrameworkElement FindElement(System.Windows.Media.Visual v, string name)
    {
        if (v == null)
            return null;
        for (int i = 0; i < System.Windows.Media.VisualTreeHelper.GetChildrenCount(v); ++i)
        {
            System.Windows.Media.Visual child = 
                System.Windows.Media.VisualTreeHelper.GetChild(v, i) as
                    System.Windows.Media.Visual;
            if (child != null)
            {
                System.Windows.FrameworkElement e = 
                    child as System.Windows.FrameworkElement;
                if (e != null && e.Name == name)
                    return e;
            }
            System.Windows.FrameworkElement result = FindElement(child, name);
            if (result != null)
                return result;
        }
        return null;
    }
    private EnvDTE.Events events;
    private EnvDTE.DTEEvents dteEvents;
}

Source: https://vlasovstudio.com/visual-commander/extensions.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜