在 Visual Studio 2015 中创建上下文子菜单 [英] Create context sub menu in visual studio 2015
本文介绍了在 Visual Studio 2015 中创建上下文子菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我创建的 VSCT 文件.我想让菜单项出现在 Visual Studio 的上下文子菜单中,右键单击将激活命令.
我使用了
This is the VSCT file I have created. I would want to make it so that the menu item appears in the context sub menu in visual studio whereby a right click will activate the command.
I have used the code from here however after configuring the VSCT file, it launches and experimental instance of VS2015 and nothing is shown in the solutions explorer tab after opening a project.
<Groups>
<Group guid="guidTestStatusBarCommandPackageCmdSet" id="MyMenuGroup" priority="0x0600">
<Parent guid="guidSHLMainMenu" id="IDM_VS_MENU_TOOLS"/>
</Group>
</Groups>
<!--Buttons section. -->
<!--This section defines the elements the user can interact with, like a menu command or a button
or combo box in a toolbar. -->
<Buttons>
<Button guid="guidTestStatusBarCommandPackageCmdSet" id="TestStatusBarCommandId" priority="0x0100" type="Button">
<Parent guid="guidTestStatusBarCommandPackageCmdSet" id="MyMenuGroup" />
<Icon guid="guidImages" id="bmpPic1" />
<Strings>
<ButtonText>Invoke TestStatusBarCommand</ButtonText>
</Strings>
</Button>
</Buttons>
<Bitmaps>
<Bitmap guid="guidImages" href="Resources\TestStatusBarCommand.png" usedList="bmpPic1, bmpPic2, bmpPicSearch, bmpPicX, bmpPicArrows, bmpPicStrikethrough"/>
</Bitmaps>
</Commands>
<Symbols>
<GuidSymbol name="guidTestStatusBarCommandPackage" value="{3e986576-99a2-451f-b96f-db7a23a0a2d3}" />
<!-- This is the guid used to group the menu commands together -->
<GuidSymbol name="guidTestStatusBarCommandPackageCmdSet" value="{f65185c1-2d22-4541-b844-ebb6193c3223}">
<IDSymbol name="MyMenuGroup" value="0x1020" />
<IDSymbol name="TestStatusBarCommandId" value="0x0100" />
</GuidSymbol>
<GuidSymbol name="guidImages" value="{4cf0f225-63ff-4812-907d-a763c7eb7c23}" >
<IDSymbol name="bmpPic1" value="1" />
<IDSymbol name="bmpPic2" value="2" />
<IDSymbol name="bmpPicSearch" value="3" />
<IDSymbol name="bmpPicX" value="4" />
<IDSymbol name="bmpPicArrows" value="5" />
<IDSymbol name="bmpPicStrikethrough" value="6" />
</GuidSymbol>
What am I doing wrong here?
解决方案
I create a demo and reproduce your issue on our side, please modify the follow code
<Parent guid="guidSHLMainMenu" id="IDM_VS_MENU_TOOLS"/>
to:
<Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_ITEMNODE"/>
这篇关于在 Visual Studio 2015 中创建上下文子菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文