我如何调用“;“新建垂直选项卡组”;来自VS2010加载项

本文关键字:选项 来自 加载项 VS2010 垂直 新建 调用 何调用 | 更新日期: 2023-09-27 18:29:03

我正在构建一个Visual Studio 2010加载项。我想做的事情之一是调用文档的垂直拆分视图。我可以在VS GUI中选择Window -> New Window,然后选择Window -> New Vertical Tab Group来完成此操作。

如何从Visual Studio外接程序调用相同的行为?

我如何调用“;“新建垂直选项卡组”;来自VS2010加载项

您可以使用ExecCommand

public void Exec(string commandName, vsCommandExecOption executeOption, ref object varIn, ref object varOut, ref bool handled)
    {
        handled = false;
        if(executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault)
        {
            if(commandName == "MyAddin1.Connect.MyAddin1")
            {
                //_applicationObject.ActiveWindow.WindowState.
                _applicationObject.ExecuteCommand("Window.NewWindow");
                _applicationObject.ExecuteCommand("Window.NewVerticalTabGroup");
                handled = true;
                return;
            }
        }
    }