如何为 Visual Studio 扩展程序向 window 添加按钮?

How can I add a button to a window for a Visual Studio Extension?

我正在尝试创建一个 Visual Studio 扩展,我需要向特定 window 添加一个按钮。我在哪里可以找到此屏幕后面的 "source code" 以便添加它?

我尝试通过不同的示例进行解析并查看文档。

     <Button guid="guidSWO" 
     id="EnableDisableguidSWO" priority="0x0100" type="Button">
        <Parent guid="guidSWO" id="MyMenuGroup" />
        <Icon guid="guidImages" id="bmpPic1" />
        <Strings>
          <ButtonText>Enable/Disable SWO</ButtonText>
        </Strings>
      </Button>

这段代码显示菜单中的按钮,但我想在快速观看菜单中显示按钮

好主意,但恐怕目前不支持此行为。

关于扩展工具的相关文档Window主题:

Extend and customize tool windows

Extend the Output window

Extend the Properties, Task List, Output, and Options windows

要在菜单中显示按钮,您可以通过创建一个 custom command template 轻松地做到这一点。而现在你想要的是扩展工具Window,你可以查看上面的文档,你会发现你可以扩展Output WindowProperties Window等等,但其他[=不支持 Quick Watch WindowDiagnostic Tools Window 等 42=]。

我们无法通过向其中添加新按钮来扩展 Quick Watch Window,据我所知,它不受支持。 Quick Watch Window 不同于 Solution ExplorerOutput Window。我认为 Output window 使用 TableControl or TableView or ListView or what 作为其 UI Window 的一部分,因此很容易扩展它,因为 VS SDK 提供了一些相关的 API,例如 IVsOutputWindow. But for Quick Watch window, there's no such API in VS SDK 扩展其 UI.