2010-04-15 8 views
5

He creado el siguiente archivo vsct xml.Usando vsx ¿cómo se crea un submenú con comandos?

<?xml version="1.0" encoding="utf-8"?> 
<CommandTable xmlns="http://schemas.microsoft.com/VisualStudio/2005-10-18/CommandTable" xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
    <Extern href="stdidcmd.h"/> 
    <Extern href="vsshlids.h"/> 
    <Extern href="msobtnid.h"/> 
    <Commands package="guidMyVSXCommandsPkg"> 
     <Menus> 
      <Menu guid="guidMyVSXCommandsCmdSet" id="TopLevelMenu" priority="0x100" type="Menu"> 
       <Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_PROJNODE"/> 
       <Strings> 
        <MenuText>Work???</MenuText> 
        <ButtonText>FigureMain</ButtonText> 
        <CommandName>TryMainMenu</CommandName> 
       </Strings> 
      </Menu> 
     </Menus> 
     <Groups> 
      <Group guid="guidMyVSXCommandsCmdSet" id="TopLevelMenuGroup" priority="0x0600"> 
       <Parent guid="guidMyVSXCommandsCmdSet" id="TopLevelMenu"/> 
      </Group> 
     </Groups> 
     <Buttons> 
      <Button guid="guidMyVSXCommandsCmdSet" id="cmdidMyCommand" priority="0x0100" type="Button"> 
       <Parent guid="guidMyVSXCommandsCmdSet" id="TopLevelMenuGroup" /> 
       <Icon guid="guidImages" id="bmpPic1" /> 
       <Strings> 
        <CommandName>cmdidMyCommand</CommandName> 
        <ButtonText>DO SOMETHING REAL COOL!!!!!!!!</ButtonText> 
       </Strings> 
      </Button> 
     </Buttons> 
     <Bitmaps> 
      <Bitmap guid="guidImages" href="Resources\Images_32bit.bmp" usedList="bmpPic1, bmpPic2, bmpPicSearch, bmpPicX, bmpPicArrows"/> 
     </Bitmaps> 
    </Commands> 
    <Symbols> 
     <!-- This is the package guid. --> 
     <GuidSymbol name="guidMyVSXCommandsPkg" value="{70e6574c-ebed-4856-b78b-0927966cc800}" /> 

     <!-- This is the guid used to group the menu commands together --> 
     <GuidSymbol name="guidMyVSXCommandsCmdSet" value="{301c910a-65eb-42c4-bf0f-bc5aaac737f1}"> 
      <IDSymbol name="TopLevelMenu" value="0x0100" /> 
      <IDSymbol name="TopLevelMenuGroup" value="0x0200" /> 
      <IDSymbol name="cmdidMyCommand" value="0x0300" /> 
     </GuidSymbol> 
     <GuidSymbol name="guidImages" value="{1997bf57-349c-434a-ad64-32a3a65e35f3}" > 
      <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" /> 
     </GuidSymbol> 
    </Symbols> 

</CommandTable> 

Lo que el resultado final es que quiero ver cuando el menú contextual para tener una opción de

trabajo ??? -> HACER ALGO REAL COOL !!!!!!!!

Respuesta

13

Su menú debe tener su grupo principal en grupo en lugar del menú contextual de nivel superior. Por ejemplo, trate de cambiar esta línea:

<Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_PROJNODE"/> 

a esta línea:

<Parent guid="guidSHLMainMenu" id="IDG_VS_CTXT_PROJECT_START"/> 

Ahora debería ver "TryMainMenu" dar la cara al lado de "depuración" en el menú contextual del nodo del proyecto. Si desea que su menú exista en su propio grupo en el menú contextual de nivel superior, debe definir un nuevo grupo con el padre IDM_VS_CTXT_PROJNODE y establecer el elemento principal de su menú para eso.

Alternativamente, se puede descubrir lo que los otros grupos existentes son (además de IDG_VS_CTXT_PROJECT_START) mediante la observación SharedCmdPlace.vsct y la búsqueda de elementos del grupo con la siguiente matriz:

<Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_PROJNODE"/> 
+0

quiero darle otra 1 la punta para buscar en SharedCmdPlace.vsct es EXTREMADAMENTE útil para determinar cómo estructurar mis botones. –

Cuestiones relacionadas